the seed for the generation of the missing values.
...
further parameters for fitCopula.
Details
MAR introduce artificial missing at random values in a given complete data set. Missing values are univariate and multivariate and have generic pattern.
Value
An object of S4 class "MAR", which is a list with the following element:
perc.record.missing
Object of class "numeric". A percentage value.
db.missing
Object of class "matrix". A data set with artificial multivariate MAR.
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 MAR by introducing 30% of missing data
mar <- MAR(db.complete = x.samp, perc.miss = 0.3, seed = 11)
mar
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/MAR.Rd_%03d_medium.png", width=480, height=480)
> ### Name: MAR
> ### Title: Generation of multivariate missing at random (MAR) data
> ### Aliases: MAR
> ### 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 MAR by introducing 30% of missing data
>
> mar <- MAR(db.complete = x.samp, perc.miss = 0.3, seed = 11)
# weights: 84 (65 variable)
initial value 131.952866
iter 10 value 114.319541
iter 20 value 93.231986
iter 30 value 81.003803
iter 40 value 77.432959
iter 50 value 76.678644
iter 60 value 76.290102
iter 70 value 75.841339
iter 80 value 75.637246
iter 90 value 75.487270
iter 100 value 75.336695
final value 75.336695
stopped after 100 iterations
>
> mar
An object of class "MAR"
Slot "perc.record.missing":
[1] 26
Slot "db.missing":
[,1] [,2] [,3] [,4]
[1,] 5.966937 0.6937296 0.5305706 1.2118824
[2,] 5.477936 0.9288640 0.5150143 0.4949318
[3,] 9.976381 2.6692100 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 0.9179923 0.8124650 1.7454148
[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 0.4378481 0.6480485 0.3242802
[15,] 7.949878 1.3034472 0.8053477 1.5037154
[16,] NA 1.4831395 NA 0.7150905
[17,] NA 0.5759644 NA NA
[18,] 6.527263 0.7277481 0.8131407 0.8802033
[19,] 5.675309 2.4925278 0.8496751 0.6941416
[20,] 3.818380 0.3763987 0.7767131 0.5063563
[21,] 5.436949 0.8697335 0.8653798 0.9885767
[22,] 7.167009 2.2176979 0.9738580 1.4343013
[23,] NA 1.7383487 NA 1.8237743
[24,] 3.429688 0.9427765 0.7102854 0.8887351
[25,] 8.234457 2.2780989 0.9525857 1.1375883
[26,] NA NA 0.9260042 2.3968852
[27,] 4.450936 NA NA 0.9303377
[28,] 8.734755 NA NA NA
[29,] 9.184101 1.4889443 0.9372123 1.9182844
[30,] 8.604847 1.7325143 0.8893063 1.6961042
[31,] NA 3.3361345 0.9389256 1.4852776
[32,] 8.636361 1.3668753 0.8670165 2.0932573
[33,] 3.669162 0.3441561 0.5348765 0.8329608
[34,] 8.253179 1.7551735 0.9310083 1.8587761
[35,] 7.327129 2.5566402 0.9409496 1.2298919
[36,] 5.961533 0.7937996 0.7655772 0.9888726
[37,] 4.891002 0.6748644 0.6973654 0.7516644
[38,] NA NA 0.7616119 NA
[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,] 8.931144 NA 0.9939651 NA
[45,] 3.710308 0.3188043 NA 1.6126164
[46,] 8.534144 2.4111056 0.9490516 1.9093087
[47,] 8.663845 NA 0.9659448 NA
[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
>