t_copula_two_vars: Generate t-Copula Samples for Two Variables

View source: R/t_copula_two_vars.R

t_copula_two_varsR Documentation

Generate t-Copula Samples for Two Variables

Description

This function generates samples from a t-copula with two variables, given the specified correlation coefficient between the variables.

Usage

t_copula_two_vars(n, p)

Arguments

n

Integer. The number of samples to generate.

p

Numeric. The correlation coefficient (\rho) between the two variables. Must be in the range [-1, 1].

Details

The function internally constructs a correlation matrix for two variables:

\rho_matrix = \begin{bmatrix} 1 & p \\ p & 1 \end{bmatrix}

It then calls generate_t_copula_samples to generate samples using a t-distribution with 5 degrees of freedom.

Value

A matrix of size n x 2, where each row represents a sample, and each column corresponds to one of the two variables. The values are uniformly distributed in [0, 1].

See Also

generate_t_copula_samples

Examples

# Example usage:
samples <- t_copula_two_vars(n = 1000, p = 0.7)
head(samples)


covalchemy documentation built on April 12, 2025, 2:15 a.m.