Good afternoon,
I am trying to see if the expression of a given gene (conc_ul) is explained by 3 categories (Sample, background and Experiment).
Initially I am trying to check which is the most simple model to explain my data by doing the following:
m1<-glm(conc_ul ~ Sample*background+Experiment+Experiment:Sample+Experiment:background,family="quasipoisson", data=mydata)
m2<-glm(conc_ul ~ Sample*background+Experiment+Experiment:Sample,family="quasipoisson", data=mydata)
anova(m1,m2,test="Chisq")
(...)
and so on until I cannot simplify deeper my model
Once I have the categories and interactions that explain the conc_ul (simpler model) I wanted to do the multiple comparisons between the levels of each category using:
(m6 is the more simplified model for a given gene)
m6<-glm(conc_ul ~ Sample+Experiment,family="quasipoisson", data=mydata)
lsm_m6 <- lsmeans(m6, ~ Sample | Experiment, test="Tukey")
plot(lsm_m6)
cld(lsm_m6, alpha = 0.01)
Here it comes the problem.
My "Sample" category has 3 levels; "Experiment" has 2. Only 1 of the experiments has the 3 levels of Sample, the other one has 2.
For some of my genes when I do the multiple comparisons using lsmeans and cld the 3 levels of Sample appear for BOTH levels of "Experiment". I already checked if there is something wrong in my input file which is not the case.
I don't know what I am doing wrong or if I am using incorrectly lsmeans for this analysis.
I would really appreciate if someone could help me with this! :)
Many thanks and all the best, Marta
?subset
"Factors may have empty levels after subsetting; unused levels are not automatically removed. See droplevels for a way to drop all unused levels from a data frame." $\endgroup$