Hello, Maybe something like the following.
cf <- vector("list", 500) for (i in 1:500){ s <- paste0("Chain",i) cf[[i]] <- mi.txt.i@imp[[s]]$cont.y.obs@model$coefficients } Hope this helps, Rui Barradas Em 23-09-2013 14:17, Andrea Lamont escreveu:
Hello: I am running a simulation in which need to pull out the coefficients of a multiply imputed object for each simulation. The coefficientscould be called using the following command: mi.txt.i@imp$Chain1$cont.y.obs@model$coefficients THis gives me the coefficients for the first imputation (Chain 1). What I would like to do, however, is pull out the coefficients for all Chains but cannot figure out how.In other words, I want the coefficients from Chain1-Chain500 saved in a matrix. mi.txt.i@imp$Chain1$cont.y.obs@model$coefficients mi.txt.i@imp$Chain2$cont.y.obs@model$coefficients mi.txt.i@imp$Chain3$cont.y.obs@model$coefficients ... mi.txt.i@imp$Chain500$cont.y.obs@model$coefficients I tried using paste: for (i in 1:500){ s=paste("Chain",i) mi.txt.i@imp$s$cont.y.obs@model$coefficients ...} But that did not work. I also tried other variations of this looping with no avail. Thoughts on how to use a loop to call coefficients? Thanks,
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.