Title: | Generate Customized Correlation Matrices |
---|---|
Description: | Provides a function that generates a customized correlation matrix based on limit values and proportions for intervals composed by its limits. It can also generate random matrices with low, medium, and high correlations, in which low, medium, and high thresholds are user-defined. |
Authors: | Helgem de Souza Ribeiro Martins[aut, cre], Anderson Ribeiro Duarte[aut] |
Maintainer: | Helgem de Souza Ribeiro Martins <[email protected]> |
License: | GPL-3 |
Version: | 1.0.2 |
Built: | 2024-11-22 06:23:17 UTC |
Source: | https://github.com/cran/gencor |
This method generates custom correlation matrices based on user-defined limits and/or proportions.
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 )
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 )
d |
Dimension of the generated matrix. If not informed, |
method |
The method of matrix generation.
|
custom_prop |
Vector with custom proportions for every band defined by |
nsim |
Size of vectors used to generate the correlation matrix. |
lim_low |
The lower limit of generated correlations. Applied in |
lim_medium |
The medium limit of generated correlations. Applied in |
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.
|
custom_precision |
The precision used in |
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. |
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.
gencor(...)
returns an object of class "gencor" with a list of the following objects:
Matrix - The generated correlation matrix.
Method - The method used in generation
Proportions - The observed proportions at each level. The levels are given by default or user defined.
Runtime - Ellapsed simulation time
Nsim - Number of iterations needed to achieve the desired correlation matrix. 0 if the chosen method was "random".
Precision - The precision used on the optimization method.
Dimension - The dimension of the generated correlation matrix.
Sdev - Vector of standard deviations used in generation process.
Custom_propp - User defined proportions in custom method. NULL if the chosen method was random.
custom_lim - User defined correlation limits in custom method. NULL if the chosen method was random.
Signal - Type of signal generation defined by the user, "random" by default.
Nrep - Size of simulated data matrix used in correlation matrix generation.
Generated data - Simulated data used in the generation process.
## 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))
## 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))