[R] [FORGED] Error from lme4: "Error: (p <- ncol(X)) == ncol(Y) is not TRUE"
Rolf Turner
r.turner at auckland.ac.nz
Tue Sep 22 23:26:04 CEST 2015
On 23/09/15 01:18, Rory Wilson wrote:
> Hello all, I am trying to run a random intercept model using lme4.
> The random effect is a factor of 29 possibilities, making a model
> with one random effect (one level). It is just a linear model. There
> are 713 observations. However, when trying to run the model I receive
> the error "Error: (p <- ncol(X)) == ncol(Y) is not TRUE", a search
> for which reveals somewhat surprisingly little. Has anyone seen this
> before? Note that if I simply change the random effect into a fixed
> effect and use lm, the model works perfectly.Thank you!
[Caveat: I really find the syntax of lmer() incomprehensible, so my
example below could be a load of dingos' kidneys.]
I think a reproducible example (as specified by the posting guide) is
needed here. When I do:
set.seed(42)
f <- factor(sample(1:29,713,TRUE))
x <- seq(0,1,length=713)
y <- rnorm(713)
require(lme4)
fit <- lmer(y ~ x + (1|f))
I get a reasonable (???) looking result and no error messages.
cheers,
Rolf Turner
--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276
More information about the R-help
mailing list