Description Usage Arguments Value Examples
Conditional simulation from a Gaussian Copula distribution.
1 | rgcopCond(n, gCop, XCond, iCond)
|
n |
Integer number of random draws. |
gCop |
An object of class |
XCond |
Vector or matrix; values of the variables on which to condition. |
iCond |
Vector of logicals, or characters specifying which are the random variables on which to condition. |
An n x (nrv-nCond)
matrix containing the draws from the conditional distribution.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | require(GaussCop)
#conditionally simulate data and plot it
n = 1e4
dat1 = rnorm(n, mean = 1, sd = 3)
dat = cbind(dat1,
rnorm(n, mean = dat1, sd = 2),
rnorm(n, mean=dat1, sd = 10))
plot(dat[, c(2, 3)]) # plot a subset of the data
# fit Gaussian Copula using gc4 method
temp.cop = gcopFit(X = dat, fitXD = "gc4")
# simulate data from Copula model and add it to plot, should blend in
new.data = rgcopCond(n, gCop = temp.cop, XCond = as.matrix(dat1), iCond = !c(FALSE, TRUE, TRUE))
points(new.data, cex = 0.5, col="red") # plot points from subsetted copula
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.