I would like to estimate models with either the intercept (model a) or the slope (model b) are fixed, and also estimate unconstrained model (c), where each of these parameters was allowed to vary, and a null model (d), where none could. Then, I would like to compare them using Log-likelihood ratio test of BIC/AIC values (I don't know what's better).
Here is my code, but I don't know if it's appropriate. Note also that I consider here only 1 subject, but how to integrate this model comparison for several subjects?
I have reaction times for several conditions that I transformed into quantiles and then I use probate and reciprobit scales 'to normalize' them.
library(pracma)
library(lmtest)
library(ggplot2)
library(scales)
rt1 <- c(2343, 1411, 928, 767, 929, 775, 1008, 922, 1127, 1516, 904, 771, 1044, 974, 1096, 1688, 2018, 1726, 1523, 1910, 1186, 1287, 1220, 834, 1267,1827, 859, 835, 1729, 859, 1305, 1238, 1451, 756, 1331, 872, 729, 1053, 789, 982, 737, 1410, 865, 926, 885, 1026, 657, 1528, 1046, 930, 770, 936, 1019, 1156, 964, 1951, 783, 769, 1693, 775, 688, 913)
rt2 <- c(1143, 752, 1071, 1215, 698, 803, 751, 869, 679, 801, 830, 935, 794, 676, 960, 857, 873, 658, 918, 769, 649, 676, 829, 803, 672, 647, 756, 719, 558, 654, 854, 707, 676, 795, 632, 666, 764, 685, 699, 534, 547, 721, 837, 778, 608, 532, 564, 686, 830, 850, 577, 591, 630, 612, 728, 540, 785, 622, 538, 635, 606, 1083)
## Quantiles
qq1 = quantile(rt1,pp)
qq2 = quantile(rt2,pp)
qq1inv = -1/qq1*1000
qq2inv = -1/qq2*1000
## Probit scale
pp = c(1,2,3,5,6,seq(10,90,5),95,96,97,98,99)/100
## Create dataframe
inv_qquantile <- c(qq1inv,qq2inv)
pp_scale <- rep(pp,length.out=length(qquantile))
conditions <- c(rep('cond1',length.out=length(qq1inv)),rep('cond2',length.out=length(qq2inv))
dataall=data.frame(condition,inv_qquantile,pp_scale)
ggplot(dataall, aes(inv_qquantile,pp_scale,color=condition)) +
geom_point() +
scale_y_continuous(trans = probit_trans())+
geom_smooth(method = lm,se=F)
The I have my 4 models:
## Estimate models
#-- slope fixed
a = glm(pp_scale ~ 0+inv_qquantile+condition,family = binomial(link = "probit"), dataall)
#-- intercept fixed
b = glm(pp_scale ~ inv_qquantile:condition,family = binomial(link = "probit"), dataall)
#-- unconstrained model
c = glm(pp_scale ~ inv_qquantile*condition,family = binomial(link = "probit"), dataall)
#-- null model
d = glm(pp_scale ~ 1,family = binomial(link = "probit"), dataall)
BIC(a)
BIC(b)
BIC(c)
BIC(d)