[R] Regarding Modeling - Please! QUICK HELP
Patrick Coulombe
patrick.coulombe at gmail.com
Thu Apr 25 08:25:00 CEST 2013
Hi Andrew,
I don't know the dataset at all (and you seem to assume that your
readers will), but anyway: it looks like you're trying to do an
intercept-only model. If that's the case, try:
> logmod11 <- lmer(log(Reaction) ~ 1 + (1|Subject),REML=FALSE)
1 is the intercept, and anything in parentheses are your random
effects--in this case, the intercept is random, and your level-2 class
variable is Subject (several lines per Subject).
If you want to add Days as a predictor, try:
> logmod11 <- lmer(log(Reaction) ~ 1 + Days + (Days|Subject),REML=FALSE)
Here, both the intercept and the coefficient for Days are random
(allowed to vary for each Subject). Don't forget to include the
dataset after your formula if it's not attached to your environment.
Hope this helps,
Patrick
2013/4/24 Andrew Cochrane <jandrew.cochrane at gmail.com>:
> I'm a student currently working with the *sleepstudy* dataset in
> matrix.pkg. It deals with the reaction times of sleep deprived students
> over a period of days.
>
> I am trying to model reaction times in order to describe the variation
> between students by days they havent slept.
>
> This is what I'm running in R, but unfortunately I'm missing something:
>
>
>> logmod11 <- lmer(log(Reaction) ~ (Subject|Days),REML=FALSE)
>
>
> This is obviously incorrect, so If someone could give me some quick help
> I'd really appreciate it.
>
> Thanks!
>
> --
> J. Andrew Cochrane
> University of Illinois | 2013
> College of Liberal Arts and Sciences | Statistics
> (630) 991-7502
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list