[R] lme4 question
Douglas Bates
bates at stat.wisc.edu
Wed Oct 22 23:41:33 CEST 2008
On Wed, Oct 22, 2008 at 4:18 PM, Lawrence Hanser <larry at hanser.net> wrote:
> Dear R Colleagues,
>
> I run the following two models:
>
> mod1 <- lmer(y ~ category + subcomp + (1 | id))
> mod2 <- lmer(y ~ category + subcomp + category*subcomp + (1 | id)
>
> where:
> category has 4 possible values
> subcomp has 24 possible values
> id has approx 120 values (id is nested within category, and in unequal
> numbers--i.e., unbalanced)
>
> Then to look for differences in the models I run:
>
> anova(mod1, mod2)
>
> I receive this warning message after the last command:
> In data != data[[1]] :
> longer object length is not a multiple of shorter object length
That piece of code is comparing the values of the data arguments in
the call slot of the fitted models. These are what are known as
matched calls (produced by the function match.call). The second model
you show seems incomplete. Did you miss a closing parenthesis or did
you have an explicit data argument?
I always use an explicit data argument and I probably implicitly
thought that others would do that when I wrote the piece of code in
question. I suppose I could remove that check or replace it with a
better one. The purpose of the code is to determine if it is
reasonable to compare the model fits by checking if the models were
fit to the same data.
> I think I know why this is happening (i.e., the two models are of
> different length). Is my surmise correct? If I am correct I don't
> think I should worry. Should I?
>
> Thanks.
>
> ______________________________________________
> 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