Initialize: Create Initial Objects

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

View source: R/Initialize.R

Description

write data files and initial .inp files to setup file directory system for running backwards selection using M Plus

Usage

1
2
3
4
5
6
Initialize(InitialData, NumImpute = 0, DataFileName = "NewData", 
NameFile = "New", Directry = getwd(), 
NADes = c(-99), startSeedImputations = 1000, 
InputInitializeMat = "N", WhichCat = rep(1, ncol(InitialData)), 
AllMethods = c("logreg", "polr", "pmm"), WhichImpute = rep(1, ncol(InitialData)), 
WhichRowsImp = c(1:nrow(InitialData)), PasteIND = 1)

Arguments

InitialData

dataframe of initial data

NumImpute

the number of imputated datasets to create default is 0 for no imputation

DataFileName

the name of the .dat file to be created from the initial data or imputed datasets default is "NewData"

NameFile

the name of the folder where the .inp and .out files with the same base name are stored default is "New"

Directry

the path where the folder containing the .inp .out and .dat files are saved during backward selection

NADes

a list of length 1 with the value for missing data default is c(-99)

startSeedImputations

the seed for the first imputed data sets all other data sets seed is plus one from this value default is 1000

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 default creates upper triangular data frame

WhichCat

list of length number of variables in InitialData with 1 for categorical and 0 for continuous variables default is all 1s for all categorical data

AllMethods

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

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

PasteIND

a value of 1 indicates to use all possible indirect effects in modelling and a value of 0 is input to only use direct effects in modelling

Details

this function must be run before using any other of the important functions in order to create initial input files

Value

Output is list of length 2:

AllNames

list containing the names of the folders containing each imputed data set path analysis

AllDataNames

list containing the name of the imputed datasets which is just length one element if there are no imputations. Also files are written and saved.

Note

the PasteIND=0 option should be used when the set of variables is too large to specify all indirect effects. In selection, AllBackwardSelect, if the m plus first .inp file fails to run due to a singularity issue, consider creating a new InputInitializeMat. See CreateInitializeMatrix for the format of the InputInitializeMat, and consider replacing some 1 values for included paths with 0s to not include the path. It is also very important that all variables start with a capital letter and contain only numbers and letters (no spaces or special characters) in this version

Author(s)

William Terry

References

MplusAutomation and mice

See Also

CreateInitializeMatrix

Examples

1
2
3
4
5
6
7
## Not run: 

InitD=Simulate(MissingYN=1)
xxx=Initialize(InitD,NumImpute=3,WhichCat=c(1,1,1,1,0))


## End(Not run)

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