generate_copula: Sample data from Gaussian copula distribution

generate_copulaR Documentation

Sample data from Gaussian copula distribution

Description

Sample mixed data vector containing continuous, ordinal and binary data from a Gaussian copula model

Usage

generate_GC(
  n = 2000,
  var_types = NULL,
  cont_transform = NULL,
  cutoff_by = "quantile",
  qmin = 0.05,
  qmax = 0.95,
  num_ord = 5,
  corr = NULL,
  seed = NULL,
  data_only = TRUE
)

generate_LRGC(
  rank = 5,
  sigma = 0.1,
  n = 2000,
  var_types = NULL,
  cont_transform = NULL,
  cutoff_by = "quantile",
  qmin = 0.05,
  qmax = 0.95,
  num_ord = 5,
  W = NULL,
  seed = NULL,
  data_only = TRUE
)

Arguments

n

number of samples to draw

var_types

A list indicating the locations of continuous, ordinal and binary variables. The sum of its elements, p, is the desired number of variables

cont_transform

A monotonic function to be applied to continuous columns

cutoff_by

When ordinalizing, select cut points by absolute values if dist and by quantiles if quantile

qmin

Cutoff points are selected in the range of qmin and qmax quantiles of the data

qmax

See qmin

num_ord

Number of ordinal levels to use

corr

Only used for generate_gc. NULL, or a correlation matrix or a list of copula correlation matrices

seed

random seed

data_only

If TRUE, only return the generated data matrix

rank

Only used for generate_lrgc

sigma

Only used for generate_lrgc. A scalar between 0 and 1.

W

Only used for generate_lrgc. NULL, or a matrix of dimension p by rank

Details

For generategc, if corr is NULL, it will be allocated a random correlation matrix. For generate_lrgc, if W is NULL, it will be allocated a random matrix. corr used in LRGC is Wt(W)+sigma*I. If corr is a single correlation matrix, n samples will be generated from the Gaussian copula model with corr as the copula correlation. If corr is a list of correlation matrices, for each element of corr, n samples will be generated from the Gaussian copula model with that element as its copula correlation.

Functions

  • generate_GC: Generate samples from a full rank Gaussian copula

  • generate_LRGC: Generate samples from a low rank Gaussian copula

Examples

generate_GC(n=500, var_types = list('cont'=1:5, 'ord'=6:10, 'bin'=11:15))
generate_GC(n=500, var_types = list('cont'=1:5, 'ord'=6:10), cont_transform=function(x)x^3)
generate_GC(n=500, var_types = list('cont'=1:5, 'ord'=6:10), num_ord=3)
f = function(x)x^3
generate_LRGC(rank = 5, sigma = 0.1, n = 500, var_types = list('cont'=1:99), cont_transform = f)
generate_LRGC(rank = 5, sigma = 0.1, n = 500, var_types = list('ord'=1:99), num_ord = 10)
generate_LRGC(rank = 5, sigma = 0.1, n = 500, var_types = list('bin'=1:99))

udellgroup/mixedgcImp documentation built on Jan. 25, 2023, 7:55 p.m.