gencor {gencor}R Documentation

Generates custom correlation matrices

Description

This method generates custom correlation matrices based on user-defined limits and/or proportions.

Usage

gencor(
  d = 10,
  method = c("random", "low", "medium", "high", "custom"),
  custom_prop = NULL,
  nsim = 1000,
  lim_low = 0.3,
  lim_medium = 0.6,
  custom_lim = NULL,
  signal = c("random", "positive"),
  custom_precision = 0.03,
  custom_nrep = 1000,
  sort_intensity = F,
  random_liminf = 0.01,
  seed = NULL
)

Arguments

d

Dimension of the generated matrix. If not informed, d = 10

method

The method of matrix generation.

  • "random": generates a random matrix with the given dimension;

  • "low": generates a matrix of values between -lim_low and lim_low;

  • "medium": generates a matrix of values in the interval
    [-lim\_medium, -lim\_low) U (lim\_low, lim\_medium];

  • "high": generates a matrix of values between lim_medium and 1.

  • "custom": Generates a matrix given the custom limits and proportions of each band defined by the limits.

custom_prop

Vector with custom proportions for every band defined by lim_low and lim_medium or custom_lim. If not defined, the proportions will be equally distributed among the correlation bands.

nsim

Size of vectors used to generate the correlation matrix.

lim_low

The lower limit of generated correlations. Applied in low and medium methods by standard and in custom method if custom_lim are not informed.

lim_medium

The medium limit of generated correlations. Applied in low and medium methods and in custom method if custom_lim are not informed.

custom_lim

Number or numeric vector with customized limits to generate the correlation matrix.

signal

Defines if the signals of the correlation matrix must be chosen at random or all must be positive.

  • "positive": generates a correlation matrix with all correlations positive. Some negative signals may occur for correlations sufficiently near zero.

  • "random": generates a correlation matrix with random signals

custom_precision

The precision used in custom method. It is the maximum difference between custom_prop and the proportions generated by the function

custom_nrep

The number of iterations in the optimization method used to generate custom correlation matrices.

sort_intensity

Sorts the correlation matrix by intensity.

random_liminf

Sets the lower limit of uniform distribution that generates the standard deviations used in random correlation matrix generation. Must be greater than zero due to convergence problems.

seed

Enables seed definition.

Details

This method generates correlation matrices based on the correlations among normal random variables with mean 0 and specified standard deviation values. These specified standard deviation values make possible the control of the correlation coefficient intensity.

Value

gencor(...) returns an object of class "gencor" with a list of the following objects:

Examples


## Generates a random correlation matrix with dimension 10
gencor()

## Generates a correlation matrix with correlations below 0.3 
gencor(15, method = "low", lim_low = 0.3)

## Generates a correlation matrix with correlations between 0.3 and 0.7
gencor(15, method = "medium", lim_low = 0.3, lim_medium = 0.7)

## Generates a correlation matrix with correlations above 0.7
gencor(30, method = "high", lim_medium = 0.75)

## Generates a custom correlation matrix with: 
## - 30% of values below 0.2, 
## - 30% of values between 0.2 and 0.5,
## - 20% of values between 0.5 and 0.8,
## - 20% of values above 0.8
gencor(20, method = "custom", custom_lim = c(0.2, 0.5, 0.8), custom_prop = c(0.3, 0.3, 0.2, 0.2))



[Package gencor version 1.0.2 Index]