Dear All,
wonder if you have some thoughts on running the with() function (and perhaps
including the pool() function to get the results?) in glmulti? In other words,
how to run glmulti with a data set that is produced by mice()?
publicly available code:
data <- airquality
data[4:10,3] <- rep(NA,7)
data[1:5,4] <- NA
data <- data[-c(5,6)]
library(mice)
library(glmulti)
the following line will compute the missing data:
tempData <- mice(data,m=5,maxit=50,meth='pmm',seed=500)
and the following 2 lines will run the regression on the mice output and pool
the results to establish the final result of interest for the model specified...
modelFit1 <- with(tempData,glm(Temp~ Ozone+Solar.R+Wind))
summary(pool(modelFit1))
with glmulti I am trying to establish the "best" model by evaluating
combinations of all predictors and interactions in different models and would
like to force the variable "Ozone" into all models with the following
code:
glm.redefined = function(formula, data, always="", ...)?
{glm(as.formula(paste(deparse(formula), always)), data=data, ...)}
then run glmulti:
output<-glmulti(with(tempData,Temp~Solar.R+Wind),?
? ? ? ? ? ? ? ? fitfunc=glm.redefined,?
? ? ? ? ? ? ? ? level=1,?
? ? ? ? ? ? ? ? crit=aic,?
? ? ? ? ? ? ? ? method="h",?
? ? ? ? ? ? ? ? always= "+Ozone")
which will obviously fail once you give it a try... any thoughts on how to
identify the best model using glmulti in this fashion? that would fit the
different combination of predictors with interactions on the mice() output of
tempData?
much appreciate the help...
Andras?