[R-sig-ME] lme4
Dan Selechnik
danselechnik at gmail.com
Sat Jul 15 03:26:42 CEST 2017
Hello,
My name is Dan and I'm a PhD student in Australia. I was hoping that I
could ask you for some help with using lme4. I have a dataset in which I
have PC1 as a response variable. Population, treatment, RBC, and
population*treatment are my explanatory variables. ID is a random factor.
(I have attached the CSV file here)...
I am trying to run a power analysis, and first to fit my data using lmer.
First I read my data into R:
pc1=read.csv("R-PowerAnalysis.csv", header=TRUE)
Then I attempt to fit:
fm1=lmer(pc1$PC1 ~ pc1$RBC + pc1$Population + pc1$Treatment +
pc1$Population*pc1$Treatment + (1|pc1$ID), data=pc1, REML=FALSE)
However, this fails, returning the message:
Error: number of levels of each grouping factor must be < number of
observations
My number of populations and treatments is much less than my number of
observations, so I am not sure why I am getting this error... Also, when I
run this, it works fine:
fm1=lm(pc1$PC1 ~ pc1$RBC + pc1$Population + pc1$Treatment +
pc1$Population*pc1$Treatment + (1|pc1$ID), data=pc1)
I was hoping I could ask for your assistance in figuring out what may be
the problem. Thank you very much.
Cheers,
Dan
More information about the R-sig-mixed-models
mailing list