The Gaussian Copula distribution.
dgcop(X, gCop, log = FALSE, decomp = FALSE) rgcop(n, gCop)
X |
|
---|---|
gCop | An object of class |
log | Logical; whether or not to evaluate the density on the log scale. |
decomp | Logical; if |
n | Number of random samples to draw. |
dgcop
provides the density of gCop
, rgcop
generates random values from gCop
.
The density of Gaussian Copula distribution is $$ g(x) = \frac{\psi(z \mid R) \prod_{i=1}^d f_i(x_i)}{\prod_{i=1}^d\phi(z_i)}, $$ $$ z_i = \Phi^{-1}(F_i(x_i)), $$ where \(\psi(z \mid R)\) is the PDF of a multivariate normal with mean 0 and variance \(R\), \(f_i(x_i)\) and \(F_i(x_i)\) are the marginal PDF and CDF of variable \(i\), and \(\phi(z)\) and \(\Phi(z)\) are the PDF and CDF of a standard normal.
gcopFit
for constructing gaussCop
objects and fitting the Gaussian Copula model to observed data.
# simulate data and plot it n = 5e4 dat = cbind(rnorm(n, mean = 1, sd = 3), rnorm(n, mean=4, sd = 0.5)) plot(dat, cex=0.5)# fit Gaussian Copula temp.cop = gcopFit(X = dat, fitXD = "kernel") # simulate data from Copula model and add it to plot, should blend in new.data = rgcop(100, temp.cop) points(new.data, cex = 0.5, col="red")