[R-sig-ME] Random slopes for logistic mixed effects model; BoxCox transformation
ONKELINX, Thierry
Thierry.ONKELINX at inbo.be
Mon Aug 4 09:37:23 CEST 2014
Dear Yusa,
(1+block|subject) is possible when you have enough data. That is when you have multiple observation for all (or at least most of the) combinations of block and subject. Since you are dealing with binomial data, you should have both absence and presence data for most of the combinations. Otherwise you get in to problem with quasi-complete separation.
If some of the information in your dataset can be predicted by either the fixed or the random effects, then the model will use the fixed effects. In that case the variance of the random effects will be very small or even 0.
Personally I don't like Boxcox transformations on predictor variables. It makes the model much harder to understand. Note that I do use transformations, but rather depending on the type of variable. E.g. log transformation on concentrations of chemical elements, square root for areas, ...
Best regards,
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium
+ 32 2 525 02 51
+ 32 54 43 61 85
Thierry.Onkelinx op inbo.be
www.inbo.be
To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of.
~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data.
~ Roger Brinner
The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey
-----Oorspronkelijk bericht-----
Van: r-sig-mixed-models-bounces op r-project.org [mailto:r-sig-mixed-models-bounces op r-project.org] Namens Yasuaki SHINOHARA
Verzonden: maandag 4 augustus 2014 3:03
Aan: r-sig-mixed-models op r-project.org
Onderwerp: [R-sig-ME] Random slopes for logistic mixed effects model; BoxCox transformation
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
_______________________________________________
R-sig-mixed-models op r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
* * * * * * * * * * * * * D I S C L A I M E R * * * * * * * * * * * * *
Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document.
The views expressed in this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed by a duly signed document.
More information about the R-sig-mixed-models
mailing list