[R-sig-ME] Random slopes for logistic mixed effects model; BoxCox transformation
Yasuaki SHINOHARA
y.shinohara at aoni.waseda.jp
Mon Aug 4 03:03:19 CEST 2014
Dear all,
Hello, I am doing research of second language acquisition.
I am wondering about glmer in R for my analyses. Could you please
answer the following questions?
I collected data of the perceptual identification tests of English
sounds before and after 10 perceptual training sessions by non-native
English speakers.
I am analysing data with logistic mixed effects model because the
dependent variable is correct/incorrect binomial data of perceptual
identification.
But I am now wondering about random slopes.
<1. Random slopes>
The following is the best model for my perceptual tests.
model<-glmer(corr~block+TrainerOrder+rl_pos+bcExp+block:TrainerOrder+TrainerOrder:rl_pos+block:bcExp+(1+block|subject)+(1+block|word:speaker),family=binomial,data=alldata,control=glmerControl(optimizer="bobyqa",
optCtrl=list(maxfun=100000)))
I included the random factor of (1+block|subject).
I think (1+block|subject) corrects variance of perceptual improvement
from pre to post tests between subjects (i.e., excluding the effects
of subjects' difference in perceptual improvement from pre to post
test).
However, I included the fixed factor of "block:bcExp" in this model.
"block" means testing block contrasting pre vs. post tests(categorical
data).
"bcExp" means the English experience in terms of the length (weeks) of
staying in English speaking countries.
English experience (weeks) was transformed by BoxCox transformation
method with lambda = 0.24(continuous data).
I think the interaction of "block:bcExp" tests the effects of English
experience on the perceptual improvement from pre to post test (e.g.,
whether the less English experienced subjects improved less than the
more English experienced subjects, vice versa).
In other words, block:bcExp tests the difference in improvement
between subjects in terms of the length of staying in English speaking
countries.
If my understanding is correct, I am not sure I should include the
random factor of (1+block|subject) or not, because including
"(1+block|subject)" as a random factor conflicts with the fixed factor
of "block:bcExp" to some extent(although "block:bcExp" tests the
regression with the length of staying in English speaking countries
and (1+block|subject) just excludes the effects of subjects'
difference in their improvements from pre to post).
I think I should include (1|subject) instead of (1+block|subject).
[QUESTION]
- Could I ask you whether I should include (1+block|subject) in the
model?
- Or should I use (1|subject) instead of (1+block|subject)?
- Or should I use the best fitting model based on AIC value in any
way?
I also have other data for testing age effects on learning
second-language (English) perception.
"age" is also continuous data, so that it is similar to English
experience data above.
In this case, I am not sure whether I should include
"(1+block|subject)" as a random factor, because it conflicts with
"block:age" included as a fixed factor, to some extent.
<2. BoxCox transformation>
I use BoxCox transformation when I have a continuous data as a fixed
factor to get the better fitting model. I always make "for loop" to
test which lambda value make the model fit best in terms of AIC value.
However, sometimes, the "for loop" stops working in the middle with
showing the following error message.
cx<-seq(2.2,2.4,by=0.01)
tbl<-NULL
ld<-NULL
aic<-NULL
for (i in cx) {
alldata$bcExp<-bcPower(alldata$EngExp_months+0.0001, lambda = i,
jacobian.adjusted = FALSE)
model<-glmer(corr ~
block*TrainerOrder*bcExp+(1+block|subject)+(1+block|stim),
family=binomial, data=alldata,control=glmerControl(optimizer="bobyqa",
optCtrl=list(maxfun=100000)))
ld<-rbind(ld,i)
aic<-rbind(aic,AIC(model))
}
Error: (maxstephalfit) PIRLS step-halvings failed to reduce deviance
in pwrssUpdate
In addition: Warning message:
In checkScaleX(X, ctrl = control) :
Some predictor variables are on very different scales: consider
rescaling
[QUESTION]
- What exactly does this error message mean?
- In this case, does it mean I should not use BoxCox transformation
and try polynomial functions (e.g., poly(EngExp,2) or poly(EngExp,3)),
although the model with boxcox transformation fits better than other
models with polynomial transformations.
- What should I do when I get this error message?
Could you please answer my questions above?
Thank you very much in advance.
Best wishes,
Yasu
More information about the R-sig-mixed-models
mailing list