MNAR.data {MonteCarloSEM}R Documentation

This function inserts missingness (Missing Not at Random - MNAR) into the given data sets.

Description

Missing values (MNAR) will be added to the Generated data sets (Generated by sim.skewed() or sim.normal() functions). Under MNAR, the missingness was associated with the values of the variable itself. In order to create MNAR, the variable was sorted first. Then, based on the given percent of missingness, 90 percent of the missing values were selected from the top. The remaining 10 percent of missing values were assigned from the rest of the variable. For example, let’s say the sample size was 300, and 20 percent of missingness was wanted (missing count: 300x20 The missing values 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 "MNAR_List.dat". The file includes the names of the data sets which has missing values in it.

Usage

MNAR.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 which 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.
MNAR.data(misg = mis.items, perct = 20, dataList = dl, f.loc=floc)

[Package MonteCarloSEM version 0.0.8 Index]