Learn R Programming

PathSelectMP (version 1.1)

DatImputations: Impute Data

Description

Imputes missing data using mice

Usage

DatImputations(InitialData, ImputeSeed, NADes, DataFileNameS, 
WhichCat, WhichImpute, WhichRowsImp, AllMethods)

Arguments

InitialData

dataframe of data to be used in model creation

ImputeSeed

the seed for imputations

NADes

the missing value designation

DataFileNameS

name of imputed data file

WhichCat

vector length of names of InitialData specifying '1' for categorical and '0' for continuous variable

WhichImpute

vector length of names of InitialData specifying '1' for Impute column and '0' for no Imputation

WhichRowsImp

vector length of number of rows of InitialData specifying '1' for Impute row and '0' for no Imputation

AllMethods

default is set at "logreg" for binary imputation "polr" for categorical imputation "pmm" for continuous

Value

No value is returned rather a new data set is saved

Details

this is a helper function for Initialize when imputations are desired by user, and it should not be used as standalone function by regular user

References

mice https://cran.r-project.org/web/packages/mice/mice.pdf

See Also

mice https://cran.r-project.org/web/packages/mice/mice.pdf

Examples

Run this code
# NOT RUN {
InitD=Simulate(MissingYN=1,exampleNum=1)
WhichCat=c(1,1,1,1,0)
WhichImpute=c(rep(1, ncol(InitD)))
WhichRowsImp=c(rep(1,nrow(InitD)))
AllMethods=c("logreg","polr","pmm")
Directry=getwd()
ImputeSeed=1000
TO=Directry
DataFileName="NewData_1000"
NameFile="New_1000"
TO=paste(TO,"/",NameFile,sep="")
DataFileNameS=paste0(TO,"/",DataFileName,".dat")
NADes=c(-99)
Initialize(InitD,NumImpute=1,WhichCat=c(1,1,1,1,0))
DatImputations(InitD,ImputeSeed,NADes,DataFileNameS,WhichCat,WhichImpute,WhichRowsImp,AllMethods)
# }

Run the code above in your browser using DataLab