Description Usage Arguments Details Value Note Author(s) References See Also Examples
View source: R/WriteInitialInpFile.R
function writes first M Plus .inp files for each imputed data set or just one file if no imputed data sets
1 2 | WriteInitialInpFile(AllData, InitialData, InputInitializeMat, IndList,
Directry, NADes, WhichCat, WhichImpute, WhichRowsImp, AllMethods)
|
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 |
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 |
IndList |
the indirect statements to write created by |
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 |
this is a helper function for Initialize
and should not be used by regular user
output is string which is the .inp file which is to be written to file using Initialize
function
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
William Terry
MPlusAutomation
MICE
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.