MAR: Generate MAR (missign at random) data

Description Usage Arguments Value Examples

Description

Generate MAR (missign at random) data

Usage

1
MAR(x, alpha, pattern, f, g)

Arguments

x

data frame where missing observations should be generated in.

alpha

proportion of cases that will get a missing data pattern

pattern

a matrix with ncol=ncol(data), nrow=numer of missing data patterns; for each patter 0 indicates missing and 1 observed.

f

frequency of each pattern

g

the odds of the patterns to occur, the strength of the mechanism

Value

A data frame that contains missing observations

Examples

1
2
3
4
5
6
7
library(MASS)
x <- mvrnorm(n=100,mu=c(0,0,0), Sigma=matrix(c(5,1,1,1,5,1,1,1,5),3,3))
alpha <- 0.25
pattern <- matrix(c(1,1,0,1,0,1),2,3, byrow=T)
f <- c(0.5,0.5)
g <- c(4,4)
MAR(x,alpha,pattern,f,g)

iriseekhout/Makemissing documentation built on May 30, 2019, 8:04 p.m.