r-mice

How extract complete dataset from Amelia package

两盒软妹~` 提交于 2019-12-06 05:10:00
In mice package for extract complete dataset you can use complete() command as follow : install.packages("mice") library ("mice") imp1=mice(nhanes,10) fill1=complete(imp,1) fill2=complete(imp,2) fillall=complete(imp,"long") But can some one tell me how to extract complete dataset in Amelia package?? install.packages("Amelia") library ("Amelia") imp2= amelia(freetrade, m = 5, ts = "year", cs = "country") The str() function is always helpful here. You'll see that the complete datasets are stored in the imputations element of the object returned by amelia() : > str(imp2, 1) List of 12 $

Can MICE pool complete GLM output binary logistic regression?

喜欢而已 提交于 2019-12-03 10:13:43
I am running a logistic regression with a binary outcome variable on data that has been multiply imputed using MICE. It seems straightforward to pool the coefficients of the glm model: imp=mice(nhanes2, print=F) imp$meth fit0=with(data=imp, glm(hyp~age, family = binomial)) fit1=with(data=imp, glm(hyp~age+chl, family = binomial)) summary(pool(fit1)) However, I can't figure out a way to pool other output generated by the glm. For instance, the glm function produces AIC, Null deviance and Residual deviance that can be used for model testing. pool(summary(fit1)) ## summary of imputation 1 : Call:

Unclear error with mice package

£可爱£侵袭症+ 提交于 2019-12-02 18:24:14
问题 I'm using the mice package to interpolate some missing values. I've successfully been using mice in many cases without any problem. However I am now facing an unprecedented problem, that is, after the first iteration I get the following error: mice(my_data) iter imp variable 1 1 sunlight Show Traceback Rerun with Debug Error in cor(xobs[, keep, drop = FALSE], use = "all.obs") : 'x' is empty I have tried to look in the documentation but I cannot find anything useful. I looked up the error on

Unclear error with mice package

梦想与她 提交于 2019-12-02 07:36:55
I'm using the mice package to interpolate some missing values. I've successfully been using mice in many cases without any problem. However I am now facing an unprecedented problem, that is, after the first iteration I get the following error: mice(my_data) iter imp variable 1 1 sunlight Show Traceback Rerun with Debug Error in cor(xobs[, keep, drop = FALSE], use = "all.obs") : 'x' is empty I have tried to look in the documentation but I cannot find anything useful. I looked up the error on the internet and found this https://stat.ethz.ch/pipermail/r-help/2015-December/434914.html but I was

MICE does not impute certain columns, but also does not give an error

青春壹個敷衍的年華 提交于 2019-12-01 19:28:55
问题 I know that similar questions have been asked before (e.g., 1, 2, 3), but I still can not understand the reason why MICE is failing to predict missing values even when I try unconditioned mean like in the example 1. The sparse matrix I have is : k1 k3 k5 k6 k7 k8 k11 k12 k13 k14 k15 [1,] NA NA NA NA NA NA NA NA NA NA 0.066667 [2,] 0.909091 NA NA NA NA 0.944723 NA NA 0.545455 NA NA [3,] 0.545455 NA NA NA NA NA NA NA 0.818182 0.800000 0.466667 [4,] 0.545455 NA 0.642857 NA NA 0.260954 NA NA NA

MICE does not impute certain columns, but also does not give an error

*爱你&永不变心* 提交于 2019-12-01 18:47:24
I know that similar questions have been asked before (e.g., 1 , 2 , 3 ), but I still can not understand the reason why MICE is failing to predict missing values even when I try unconditioned mean like in the example 1. The sparse matrix I have is : k1 k3 k5 k6 k7 k8 k11 k12 k13 k14 k15 [1,] NA NA NA NA NA NA NA NA NA NA 0.066667 [2,] 0.909091 NA NA NA NA 0.944723 NA NA 0.545455 NA NA [3,] 0.545455 NA NA NA NA NA NA NA 0.818182 0.800000 0.466667 [4,] 0.545455 NA 0.642857 NA NA 0.260954 NA NA NA NA NA [5,] NA 0.750 0.500000 NA 0.869845 NA 0.595013 NA NA NA NA [6,] 0.727273 0.625 NA 0.583333 NA

can mice() handle crr()? Fine-Gray model

青春壹個敷衍的年華 提交于 2019-12-01 13:32:05
问题 My doubt is if it is possible to pool multiple imputation data set, from "mice()", on a fit model of Fine-Gray from "crr()", and if it is statistically correct... example library(survival) library(mice) library(cmprsk) test1 <- as.data.frame(list(time=c(4,3,1,1,2,2,3,5,2,4,5,1, 4,3,1,1,2,2,3,5,2,4,5,1), status=c(1,1,1,0,2,2,0,0,1,1,2,0, 1,1,1,0,2,2,0,0,1,1,2,0), x=c(0,2,1,1,NA,NA,0,1,1,2,0,1, 0,2,1,1,NA,NA,0,1,1,2,0,1), sex=c(0,0,0,NA,1,1,1,1,NA,1,0,0, 0,0,0,NA,1,1,1,1,NA,1,0,0))) dat <- mice

multinominal regression with imputed data

杀马特。学长 韩版系。学妹 提交于 2019-12-01 11:30:35
问题 I need to impute missing data and then coduct multinomial regression with the generated datasets. I have tried using mice for the imputing and then multinom function from nnet for the multnomial regression. But this gives me unreadable output. Here is an example using the nhanes2 dataset available with the mice package: library(mice) library(nnet) test <- mice(nhanes2, meth=c('sample','pmm','logreg','norm')) #age is categorical, bmi is continuous m <- with(test, multinom(age ~ bmi, model = T)

Perform operation on each imputed dataset in R's MICE

坚强是说给别人听的谎言 提交于 2019-11-30 08:37:00
问题 How can I perform an operation (like subsetting or adding a calculated column) on each imputed dataset in an object of class mids from R's package mice ? I would like the result to still be a mids object. Edit: Example library(mice) data(nhanes) # create imputed datasets imput = mice(nhanes) The imputed datasets are stored as a list of lists imput$imp where there are rows only for the observations with imputation for the given variable. The original (incomplete) dataset is stored here: imput

Perform operation on each imputed dataset in R's MICE

馋奶兔 提交于 2019-11-29 07:11:07
How can I perform an operation (like subsetting or adding a calculated column) on each imputed dataset in an object of class mids from R's package mice ? I would like the result to still be a mids object. Edit: Example library(mice) data(nhanes) # create imputed datasets imput = mice(nhanes) The imputed datasets are stored as a list of lists imput$imp where there are rows only for the observations with imputation for the given variable. The original (incomplete) dataset is stored here: imput$data For example, how would I create a new variable calculated as chl/2 in each of the imputed datasets