Dear R Community, My data have 3 conditions and each condition has 6 replicates. I am trying to fit my data for a linear mixed model using the lmer function from lme4 package to find the random effects of the replicates; however, I got the error message. Here are the example codes:>example.3=data.frame(levels=as.numeric(XXX[,c(4)]),replicate=rep(c("0","1","2","3","4","5"),3),conditions=c(rep("11",6),rep("12",6),rep("13",6)))> example.3? ? levels replicate conditions1? 43.1111 ? ? ? ? 0 ? ? ? ? 112? 42.0942 ? ? ? ? 1 ? ? ? ? 113? 57.8131 ? ? ? ? 2 ? ? ? ? 114? 57.1726 ? ? ? ? 3 ? ? ? ? 115? 77.8678 ? ? ? ? 4 ? ? ? ? 116? 44.7578 ? ? ? ? 5 ? ? ? ? 117? 69.5078 ? ? ? ? 0 ? ? ? ? 128? 52.0581 ? ? ? ? 1 ? ? ? ? 129? 40.0602 ? ? ? ? 2 ? ? ? ? 1210 45.5487 ? ? ? ? 3 ? ? ? ? 1211 43.6201 ? ? ? ? 4 ? ? ? ? 1212 60.4939 ? ? ? ? 5 ? ? ? ? 1213 64.1932 ? ? ? ? 0 ? ? ? ? 1314 53.4055 ? ? ? ? 1 ? ? ? ? 1315 59.6701 ? ? ? ? 2 ? ? ? ? 1316 52.6922 ? ? ? ? 3 ? ? ? ? 1317 53.8712 ? ? ? ? 4 ? ? ? ? 1318 60.2770 ? ? ? ? 5 ? ? ? ? 13> m.example.3=lmer(as.numeric(levels)~conditions+(conditions|replicate),data=example.3)Error: number of observations (=18) <= number of random effects (=18) for term (conditions | replicate); the random-effects parameters and the residual variance (or scale parameter) are probably unidentifiable>?Could anyone help me figure out how to fix the issue?? Thank you very much for any inputs! Ace [[alternative HTML version deleted]]
David Winsemius
2017-Nov-14 17:19 UTC
[R] error message for function: lmer (from lme4 package)
> On Nov 14, 2017, at 5:13 AM, Fix Ace via R-help <r-help at r-project.org> wrote: > > Dear R Community, > My data have 3 conditions and each condition has 6 replicates. I am trying to fit my data for a linear mixed model using the lmer function from lme4 package to find the random effects of the replicates;Better venue for this question might be SIG-mixed-models. See the link avaialble at the bottom of every posting from rhelp: https://stat.ethz.ch/mailman/listinfo/r-help:> however, I got the error message. Here are the example codes: >> example.3=data.frame(levels=as.numeric(XXX[,c(4)]),replicate=rep(c("0","1","2","3","4","5"),3),conditions=c(rep("11",6),rep("12",6),rep("13",6)))> example.3 levels replicate conditions1 43.1111 0 112 42.0942 1 113 57.8131 2 114 57.1726 3 115 77.8678 4 116 44.7578 5 117 69.5078 0 128 52.0581 1 129 40.0602 2 1210 45.5487 3 1211 43.6201 4 1212 60.4939 5 1213 64.1932 0 1314 53.4055 1 1315 59.6701 2 1316 52.6922 3 1317 53.8712 4 1318 60.2770 5 13> m.example.3=lmer(as.numeric(levels)~conditions+(conditions|replicate),data=example.3)Error: number of observations (=18) <= number of random effects (=18) for term (conditions | replicate); the random-effects parameters and the residual variance (or scale parameter) are probably unidentifiable> > Could anyone help me figure out how to fix the issue? > Thank you very much for any inputs! > Ace > > [[alternative HTML version deleted]]Complete mess. If you haven't yet been advised to posting in plain text, then this should be your wakeup call. If you have, then why are you ignoring sensible advice?> > ______________________________________________ > R-help at 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.David Winsemius Alameda, CA, USA 'Any technology distinguishable from magic is insufficiently advanced.' -Gehm's Corollary to Clarke's Third Law
Hi, David, Thank you very much for getting back to me! Sorry about the messy code example. I am re-posting here (including the error message):> example.3=data.frame(levels=as.numeric(XXX[,c(4)]),replicate=rep(c("0","1","2","3","4","5"),3),conditions=c(rep("11",6),rep("12",6),rep("13",6)))> example.3? ? levels replicate conditions1? 43.1111 ? ? ? ? 0 ? ? ? ? 112? 42.0942 ? ? ? ? 1 ? ? ? ? 113? 57.8131 ? ? ? ? 2 ? ? ? ? 114? 57.1726 ? ? ? ? 3 ? ? ? ? 115? 77.8678 ? ? ? ? 4 ? ? ? ? 116? 44.7578 ? ? ? ? 5 ? ? ? ? 117? 69.5078 ? ? ? ? 0 ? ? ? ? 128? 52.0581 ? ? ? ? 1 ? ? ? ? 129? 40.0602 ? ? ? ? 2 ? ? ? ? 1210 45.5487 ? ? ? ? 3 ? ? ? ? 1211 43.6201 ? ? ? ? 4 ? ? ? ? 1212 60.4939 ? ? ? ? 5 ? ? ? ? 1213 64.1932 ? ? ? ? 0 ? ? ? ? 1314 53.4055 ? ? ? ? 1 ? ? ? ? 1315 59.6701 ? ? ? ? 2 ? ? ? ? 1316 52.6922 ? ? ? ? 3 ? ? ? ? 1317 53.8712 ? ? ? ? 4 ? ? ? ? 1318 60.2770 ? ? ? ? 5 ? ? ? ? 13> m.example.3=lmer(as.numeric(levels)~conditions+(conditions|replicate),data=example.3)Error: number of observations (=18) <= number of random effects (=18) for term (conditions | replicate); the random-effects parameters and the residual variance (or scale parameter) are probably unidentifiable>?Please let me know if it is readable this time.? Again, many thanks for your time and please help me fix the issue. Kind regards, Ace On Tuesday, November 14, 2017 12:19 PM, David Winsemius <dwinsemius at comcast.net> wrote:> On Nov 14, 2017, at 5:13 AM, Fix Ace via R-help <r-help at r-project.org> wrote: > > Dear R Community, > My data have 3 conditions and each condition has 6 replicates. I am trying to fit my data for a linear mixed model using the lmer function from lme4 package to find the random effects of the replicates;Better venue for this question might be SIG-mixed-models. See the link avaialble at the bottom of every posting from rhelp: https://stat.ethz.ch/mailman/listinfo/r-help:> however, I got the error message. Here are the example codes: >> example.3=data.frame(levels=as.numeric(XXX[,c(4)]),replicate=rep(c("0","1","2","3","4","5"),3),conditions=c(rep("11",6),rep("12",6),rep("13",6)))> example.3? ? levels replicate conditions1? 43.1111? ? ? ? 0? ? ? ? 112? 42.0942? ? ? ? 1? ? ? ? 113? 57.8131? ? ? ? 2? ? ? ? 114? 57.1726? ? ? ? 3? ? ? ? 115? 77.8678? ? ? ? 4? ? ? ? 116? 44.7578? ? ? ? 5? ? ? ? 117? 69.5078? ? ? ? 0? ? ? ? 128? 52.0581? ? ? ? 1? ? ? ? 129? 40.0602? ? ? ? 2? ? ? ? 1210 45.5487? ? ? ? 3? ? ? ? 1211 43.6201? ? ? ? 4? ? ? ? 1212 60.4939? ? ? ? 5? ? ? ? 1213 64.1932? ? ? ? 0? ? ? ? 1314 53.4055? ? ? ? 1? ? ? ? 1315 59.6701? ? ? ? 2? ? ? ? 1316 52.6922? ? ? ? 3? ? ? ? 1317 53.8712? ? ? ? 4? ? ? ? 1318 60.2770? ? ? ? 5? ? ? ? 13> m.example.3=lmer(as.numeric(levels)~conditions+(conditions|replicate),data=example.3)Error: number of observations (=18) <= number of random effects (=18) for term (conditions | replicate); the random-effects parameters and the residual variance (or scale parameter) are probably unidentifiable> > Could anyone help me figure out how to fix the issue? > Thank you very much for any inputs! > Ace > > ??? [[alternative HTML version deleted]]Complete mess. If you haven't yet been advised to posting in plain text, then this should be your wakeup call. If you have, then why are you ignoring sensible advice?> > ______________________________________________ > R-help at 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.David Winsemius Alameda, CA, USA 'Any technology distinguishable from magic is insufficiently advanced.'? -Gehm's Corollary to Clarke's Third Law [[alternative HTML version deleted]]