Hi Rolf,Yes, a reprodicuble example would be good - but it appears to be 
trouble with something within the data, and I cannot upload all the data here. 
Jean indicated the issue could be with NAs in the data, and I am inclined to 
agree. I will look more into that angle and see if something becomes 
apparent.Thanks for your help!Rory
      From: Rolf Turner <r.tur...@auckland.ac.nz>
 To: Rory Wilson <roryrwil...@yahoo.ca>; "r-help@r-project.org" 
<r-help@r-project.org> 
 Sent: Tuesday, September 22, 2015 11:26 PM
 Subject: Re: [FORGED] [R] Error from lme4: "Error: (p <- ncol(X)) == ncol(Y) 
is not TRUE"
   



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


  
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to