MCAR.data {MonteCarloSEM} | R Documentation |
This function inserts missingness (Missing Completely at Random - MCAR) into the given data sets.
Description
Missing values (MCAR) will be added to the Generated data sets (Generated by sim.skewed() or sim.normal() functions). Missing values are assigned at random and are shown as "NA" in the data files. The new data sets which have missing values will be saved as a different data file. In each data file, the first column shows sample numbers. The second and the other columns show actual data sets for each item. There also be a file named "MCAR_List.dat". The file includes the names of the data sets which has missing values in it.
Usage
MCAR.data(misg = NULL, perct = 10, dataList = "Data_List.dat", f.loc)
Arguments
misg |
vector of 0s and 1s for each item. 0 indicates non-missing and 1 indicates items that have missing values. If misg is not indicated all items are considered as missing. |
perct |
Percent of missingness. The default is 10 percent. |
dataList |
List of the names of data sets generated earlier either with the package functions or any other software. |
f.loc |
File location. It indicates where the simulated data sets and "dataList" are located. |
Author(s)
Fatih Orcan
Examples
# Data needed to be generated at the first step.
fc<-fcors.value(nf=3, cors=c(1,.5,.6,.5,1,.4,.6,.4,1))
fl<-loading.value(nf=3, fl.loads=c(.5,.5,.5,0,0,0,0,0,0,0,0,.6,.6,.6,0,0,0,0,0,0,0,0,.4,.4))
floc<-tempdir()
sim.normal(nd=10, ss=100, fcors=fc, loading<-fl, f.loc=floc)
# Missing values were added at the second step.
mis.items<-c(1,1,1,0,0,0,0,0)
dl<-"Data_List.dat" # should be located in the working directory.
MCAR.data(misg = mis.items, perct = 20, dataList = dl, f.loc=floc)