Skip to contents

The MNAR mechanism assumes that the probability and cause of missingness are unknown to us and lie in the unobserved data. Under this mechanism we generate missing values by looking at each variable's lowest values and replacing them with NA.

Usage

mnar.transform(input, target, features, na_rate)

Arguments

input

data to transform using MAR mechanism

target

variable to be used as causative feature

features

variables to which NA values are introduced using a causative feature

na_rate

proportion of missing values to be added to data

Value

a matrix or data frame containing NAs

Examples

set.seed(123)
data <- gen.mcar(100,rho = c(.15,.25,.12,.45,.34,.54),sigma = c(1,2,1,2),n_vars = 4, na_prob = 0)

mnar_data <- mnar.transform(data,"V1",c("V2","V3"), na_rate = .25)
summary(mnar_data)
#>        V1                 V2                V3                V4          
#>  Min.   :-2.30917   Min.   :-0.3039   Min.   :0.03673   Min.   :-4.58910  
#>  1st Qu.:-0.49385   1st Qu.: 0.3111   1st Qu.:0.38073   1st Qu.:-1.23381  
#>  Median : 0.06176   Median : 1.0246   Median :0.65188   Median : 0.09614  
#>  Mean   : 0.09041   Mean   : 1.3334   Mean   :0.85891   Mean   : 0.06959  
#>  3rd Qu.: 0.69182   3rd Qu.: 1.8039   3rd Qu.:1.26000   3rd Qu.: 1.48147  
#>  Max.   : 2.18733   Max.   : 6.1032   Max.   :2.39781   Max.   : 4.32329  
#>                     NA's   :50        NA's   :50