-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgauss_cop.R
46 lines (25 loc) · 1.13 KB
/
gauss_cop.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
url <- "https://cran.r-project.org/src/contrib/Archive/JohnsonDistribution/JohnsonDistribution_0.24.tar.gz"
pkgFile <- "JohnsonDistribution_0.24.tar.gz"
download.file(url = url, destfile = pkgFile)
install.packages(pkgs=pkgFile, type="source", repos=NULL)
unlink(pkgFile)
library(devtools)
install_github("bonorico/gcipdr")
IPD <- airquality[, -6]
md <- Return.IPD.design.matrix(IPD, fill.missing = TRUE)
IPDsummary <- Return.key.IPD.summaries( md, "moment.corr" )
moms <- IPDsummary$first.four.moments
corr <- IPDsummary$correlation.matrix
corr[lower.tri(corr)] # inspect
n <- IPDsummary$sample.size
supp <- IPDsummary$is.binary.variable
names <- IPDsummary$variable.names
H <- 1 ## number of artificial IPD copies to be generated
set.seed(8736, "L'Ecuyer")
## Gaussian copula based IPD simulation
system.time(
IPDstar <- DataRebuild( H, n, correlation.matrix = corr, moments = moms,
x.mode = supp, data.rearrange = "norta",
corrtype = "moment.corr", marg.model = "gamma",
variable.names = names, checkdata = TRUE, tabulate.similar.data = TRUE )
)