View source: R/generate_gaussian_copula_samples.R
generate_gaussian_copula_samples | R Documentation |
This function generates samples from a Gaussian copula given a specified
correlation matrix. The samples are uniformly distributed in [0, 1]
across
dimensions.
generate_gaussian_copula_samples(n, d, rho_matrix)
n |
Integer. The number of samples to generate. |
d |
Integer. The dimensionality of the copula. |
rho_matrix |
A |
The function works as follows:
Generates multivariate normal samples with the given correlation matrix.
Transforms the samples to the uniform distribution [0, 1]
using the
cumulative distribution function (CDF) of the standard normal.
A matrix of size n x d
, where each row represents a sample
and each column corresponds to a dimension. The values are uniformly
distributed in [0, 1]
.
# Example usage:
library(MASS) # Load package for `mvrnorm`
rho_matrix <- matrix(c(1, 0.5, 0.5, 1), nrow = 2) # 2x2 correlation matrix
samples <- generate_gaussian_copula_samples(n = 1000, d = 2, rho_matrix = rho_matrix)
head(samples)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.