Question

I have two small data sets:

infected.data.r.p <- structure(list(MLH = c(0.520408163265306, 0.436170212765957, 
0.344086021505376, 0.423076923076923, 0.406976744186047), ColGrowthCL_6 = c(5.923728814, 
0.283950617, 0.377358491, 1.728070175, 0.2)), .Names = c("MLH", 
"ColGrowthCL_6"), row.names = c("12", "22", "28", "30", "34"), class = "data.frame")

and

uninfected.sampling <- structure(list(MLH = c(0.524271844660194, 0.457446808510638, 
0.354838709677419, 0.398058252427184, 0.436893203883495), ColGrowthCL_6 = c(4.401639344, 
4.827586207, 6.387096774, 6.320754717, 4.225490196)), .Names = c("MLH", 
"ColGrowthCL_6"), row.names = c("218", "18", "21", "212", "99"
), class = "data.frame")

When I try to compare these two models using the anova() syntax in R (see below), it fails to produce a p-value. I'm not convinced that it is the nature of the two data sets that's causing the problem (although I'm also curious what exactly is different between the structure of the two data sets), but I suppose it very well could be the problem. Thank you!

Model comparison syntax:

infected.model<-glm(formula=as.formula(ColGrowthCL_6~MLH), family=poisson, infected.data.r.p)
uninfected.model<-glm(formula=as.formula(ColGrowthCL_6~MLH), family=poisson, uninfected.sampling)    

compare<-anova(infected.model,uninfected.model,test="Chisq")
print(compare)
summary(compare)
Was it helpful?

Solution

I believe you can only compare models that come from the same data set. So when comparing two (nested) models with Chi Squared, it needs to be from the same dataset - perhaps that is why your p-values aren't being calculated.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top