# generate data from a 4-variate Gumbel copula with different margins
set.seed(11)
n.marg <- 4
theta <- 5
copula <- frankCopula(theta, dim = n.marg)
mymvdc <- mvdc(copula, c("norm", "gamma", "beta","gamma"), list(list(mean=7, sd=2),
list(shape=3, rate=2), list(shape1=4, shape2=1), list(shape=4, rate=3)))
n <- 30
x.samp <- rMvdc(n, mymvdc)
# apply MCAR by introducing 30% of missing data
mcar <- MCAR(db.complete = x.samp, perc.miss = 0.3, setseed = 11)
mcar
# same example as above but introducing missing only in the first and third column
mcar2 <- MCAR(db.complete = x.samp, perc.miss = 0.3, setseed = 11, mcols=c(1,3))
mcar2
Run the code above in your browser using DataLab