Displaying 1 result from an estimated 1 matches for "m2lab".
Did you mean:
mplab
2012 Jun 19
1
Possible bug when using encomptest
...libraries:
library(lmtest)
##Create models:
models12<-lmList(srcData ~ model1 + model2 | modelFactor,data=allData)
##Function to test if models are nested
isNested<-function(model1, model2){
##Test if model1 is nested in model2:
m1labs<-attr(terms(model1), "term.labels")
m2labs<-attr(terms(model2), "term.labels")
rv<-m1labs[!(m1labs %in% m2labs)]
return(ifelse(length(rv),FALSE,TRUE))
}
##Show models are nested:
isNested(models1[[1]],models12[[1]]) ##See, models are nested!
##Force encomptest to break:
encomptest(models12[[1]],models1[[1]]) ##horribl...