WriteInitialInpFile: Write Inp File

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/WriteInitialInpFile.R

Description

function writes first M Plus .inp files for each imputed data set or just one file if no imputed data sets

Usage

1
2
WriteInitialInpFile(AllData, InitialData, InputInitializeMat, IndList, 
Directry, NADes, WhichCat, WhichImpute, WhichRowsImp, AllMethods)

Arguments

AllData

list of length three with the first element a list of strings with each string as the name of the folder where .inp and .out files are written, the second element is a list of strings with each string the name of the .dat file containing imputed data set or one string name of data set if no imputations, and the third element is a list of numbers of the imputation seed used by MICE for imputation which is empty if there are no imputed data sets

InitialData

dataframe of initial data

InputInitializeMat

square dataframe where row name and column names are equal and are the variable names of InitialData with 1 for include path and 0 for exclude created by CreateInitializeMatrix

IndList

the indirect statements to write created by AddOnINDStatements

Directry

list of length number of variables in InitialData with 1 for categorical and 0 for continuous variables

NADes

a list of length 1 with the value for missing data

WhichCat

list of length number of variables in InitialData with 1 for categorical and 0 for continuous variables

WhichImpute

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

WhichRowsImp

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

AllMethods

list of length 3 for MICE imputation for binary, unordered catagorical, and continuous imputations default in Initialize set as"logreg" for binary imputation "polr" for categorical imputation "pmm" for continuous

Details

this is a helper function for Initialize and should not be used by regular user

Value

output is string which is the .inp file which is to be written to file using Initialize function

Note

helper function. Also note that the input file in this version should not be modified by the user since some of the line numbers are set for reading and should not be altered

Author(s)

William Terry

References

MPlusAutomation MICE

See Also

Initialize

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Not run: 
InitD=Simulate(MissingYN=1)
NumImpute=3
startSeedImputations=1000
DataFileName="NewData"
NameFile="New"
Directry=getwd()
NADes=c(-99)
WhichCat=c(1,1,1,1,0)
AllMethods=c("logreg","polr","pmm")
WhichImpute=rep(1,ncol(InitD))
WhichRowsImp=c(1:nrow(InitD))
NumImpList=seq(startSeedImputations,(startSeedImputations+NumImpute-1),1)
NameFile=paste0(NameFile,"_")
DataFileName=paste0(DataFileName,"_")
AllData=ConvertData3(NameFile,DataFileName,NumImpList)
InputInitializeMat=CreateInitializeMatrix(InitD,WhichCat,empty=FALSE)
IndList=AddOnINDStatements(InputInitializeMat,PasteIND=1)
WRt=lapply(AllData,WriteInitialInpFile,InitD,InputInitializeMat,IndList,Directry,
NADes,WhichCat,WhichImpute,WhichRowsImp,AllMethods)

## End(Not run)

PathSelectMP documentation built on May 2, 2019, 3:15 a.m.