intern5
intern5

Reputation: 19

After using ga.lasso from the miselect package how do I pool results?

ive been running multiple imputation on a dataset using the mice package creating 5 mids objects. Using those objects ive performed variable selection using the cv.galasso function from the miselect package and the instructions on how to use it found in the documentation here https://cran.r-project.org/web/packages/miselect/miselect.pdf . However i have been unable to pool the 5 results into 1.

I am looking for a way to combine all 5 sets of coefficient estimates back into one model. How should I go about doing that?

library(miselect)
library(mice)
set.seed(48109)
# Using the mice defaults for sake of example only.
mids <- mice(miselect.df, m=5, printFlag=FALSE)
dfs <- lapply(1:5, function(i) complete(mids, action=i))
# Generate list of imputed design matrices and imputed responses
x <- list()
y <- list()
for (i in 1:5) {
  x[[i]] <- as.matrix(dfs[[i]][, paste0("X", 1:20)])
  y[[i]] <- dfs[[i]]$Y
}
pf <- rep(1, 20)
adWeight <- rep(1, 20)
fit <- cv.galasso(x, y, pf, adWeight)

Upvotes: 1

Views: 59

Answers (0)

Related Questions