Last data update: 2014.03.03

R: Generation of multivariate MCAR data
MCARR Documentation

Generation of multivariate MCAR data

Description

Introduction of artificial missing completely at random (MCAR) data in a given data set. Missing values are multivariate and have generic pattern.

Usage

MCAR(db.complete, perc.miss = 0.3, setseed = 13, ...)

Arguments

db.complete

the complete data matrix.

perc.miss

the percentage of missing value to be generated.

setseed

the seed for the generation of the missing values.

...

further parameters for fitCopula.

Details

MCAR introduce artificial missing completely at random values in a given complete data set. Missing values are multivariate and have generic pattern.

Value

An object of S4 class "MCAR", which is a list with the following element:

db.missing

Object of class "matrix". A data set with artificial multivariate MCAR.

Author(s)

Francesca Marta Lilja Di Lascio <marta.dilascio@unibz.it>,

Simone Giannerini <simone.giannerini@unibo.it>

References

Di Lascio, F.M.L. Giannerini, S. and Reale A. (201x) "A multivariate technique based on conditional copula specification for the imputation of complex dependent data". Working paper.

Di Lascio, F.M.L. Giannerini, S. and Reale A. (201x) "Exploring Copulas for the Imputation of Complex Dependent Data". Under review.

Bianchi, G. Di Lascio, F.M.L. Giannerini, S. Manzari, A. Reale, A. and Ruocco, G. (2009) "Exploring copulas for the imputation of missing nonlinearly dependent data". Proceedings of the VII Meeting Classification and Data Analysis Group of the Italian Statistical Society (Cladag), Editors: Salvatore Ingrassia and Roberto Rocci, Cleup, p. 429-432. ISBN: 978-88-6129-406-6.

Examples


# 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      <- 50
x.samp <- rMvdc(n, mymvdc)

# apply MCAR by introducing 30% of missing data

mcar   <- MCAR(db.complete = x.samp, perc.miss = 0.3, seed = 11)

mcar

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(CoImp)
Loading required package: copula
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/CoImp/MCAR.Rd_%03d_medium.png", width=480, height=480)
> ### Name: MCAR
> ### Title: Generation of multivariate MCAR data
> ### Aliases: MCAR
> ### Keywords: imputation copula multivariate
> 
> ### ** Examples
> 
> 
> # 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      <- 50
> x.samp <- rMvdc(n, mymvdc)
> 
> # apply MCAR by introducing 30% of missing data
> 
> mcar   <- MCAR(db.complete = x.samp, perc.miss = 0.3, seed = 11)
> 
> mcar
An object of class "MCAR"
Slot "db.missing":
           [,1]      [,2]      [,3]      [,4]
 [1,]        NA 0.6937296        NA        NA
 [2,]  5.477936 0.9288640 0.5150143 0.4949318
 [3,]  9.976381        NA        NA        NA
 [4,]  6.888685 1.7600194 0.7823500 1.0113803
 [5,]  3.628433 0.8100146 0.7102281 0.8478551
 [6,]  6.895156 1.7180514 0.9665612 1.3927726
 [7,]  7.354376        NA        NA        NA
 [8,]  7.399243 0.9139131 0.7225338 0.7816251
 [9,]  6.461663 1.2354032 0.5513096 0.7880760
[10,]  6.814336 1.7336717 0.9263767 1.8312253
[11,]  9.097894 1.9931929 0.9627481 1.6991499
[12,]  5.446450 1.0184831 0.9438978 1.2199807
[13,]  7.924009 1.9975273 0.9433903 1.2505458
[14,]        NA        NA 0.6480485        NA
[15,]  7.949878 1.3034472 0.8053477 1.5037154
[16,]  5.755915 1.4831395 0.9889028 0.7150905
[17,]  7.702784 0.5759644        NA 0.5656444
[18,]  6.527263 0.7277481 0.8131407 0.8802033
[19,]  5.675309 2.4925278 0.8496751        NA
[20,]  3.818380 0.3763987        NA 0.5063563
[21,]  5.436949 0.8697335 0.8653798 0.9885767
[22,]  7.167009 2.2176979 0.9738580 1.4343013
[23,] 12.410071 1.7383487 0.9953920 1.8237743
[24,]  3.429688 0.9427765 0.7102854 0.8887351
[25,]  8.234457 2.2780989        NA 1.1375883
[26,]  6.209889 1.6824550 0.9260042 2.3968852
[27,]  4.450936 0.8000187 0.5269311 0.9303377
[28,]  8.734755 1.9982806 0.8627790 1.3503003
[29,]  9.184101 1.4889443 0.9372123 1.9182844
[30,]  8.604847 1.7325143 0.8893063 1.6961042
[31,]        NA        NA        NA 1.4852776
[32,]  8.636361 1.3668753 0.8670165 2.0932573
[33,]        NA        NA 0.5348765 0.8329608
[34,]        NA        NA 0.9310083 1.8587761
[35,]  7.327129 2.5566402 0.9409496 1.2298919
[36,]        NA 0.7937996        NA 0.9888726
[37,]        NA        NA        NA 0.7516644
[38,]  5.611047 0.4588458 0.7616119 0.8635800
[39,]  7.677238 1.4926245 0.8330594 1.1269745
[40,] 10.165130 1.5522208 0.6160808 1.0114968
[41,]  8.721631 1.7246080 0.9985602 1.7605457
[42,]  5.781648 0.5967000 0.7081025 0.6994077
[43,]  5.454900 1.5180687 0.6134994 0.9564612
[44,]        NA 4.7268766 0.9939651        NA
[45,]  3.710308        NA        NA 1.6126164
[46,]  8.534144 2.4111056 0.9490516 1.9093087
[47,]  8.663845 3.1679589 0.9659448 1.6090012
[48,]  4.186640 0.7075278 0.7830599 0.5113352
[49,]  6.478190 0.4516585 0.5731004 0.7755582
[50,]  5.000664 1.1474243 0.5143085 0.5679166

> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>