Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

Cor2DataFrame

Convert correlation or covariance matrices into a dataframe of correlations or covariances with their sampling covariance matrices


Description

It converts the correlation or covariance matrices into a dataframe of correlations or covariances with their asymptotic sampling covariance matrices. It uses the asyCov at the backend.

Usage

Cor2DataFrame(x, n, v.na.replace = TRUE, row.names.unique = FALSE,
              cor.analysis = TRUE, acov="weighted", append.vars=TRUE, ...)

Arguments

x

A list of data with correlation/covariance matrix in x$data and sample sizes x$n. Additional variables in x can be attached.

n

If x is a list of correlation matrices without x$data and x$n, a vector of sample sizes n must be provided.

v.na.replace

Logical. Missing value is not allowed in definition variables. If it is TRUE (the default), missing value is replaced by a large value (1e10). These values are not used in the analysis.

row.names.unique

Logical, If it is FALSE (the default), unique row names are not created.

cor.analysis

Logical. The output is either a correlation or covariance matrix.

acov

If it is weighted, the average correlation/covariance matrix is calculated based on the weighted mean with the sample sizes. The average correlation/covariance matrix is used to calculate the sampling variance-covariance matrices.

append.vars

Whether to append the additional variables to the output dataframe.

...

Further arguments to be passed to asyCov.

Value

A list of components: (1) a data frame of correlations or covariances with their sampling covariance matrices; (2) a vector of sample sizes; (3) labels of the correlations; and (3) labels of their sampling covariance matrices.

Author(s)

Mike W.-L. Cheung <mikewlcheung@nus.edu.sg>

See Also

Examples

## Not run: 
## Provide a list of correlation matrices and a vector of sample sizes as the inputs
my.df1 <- Cor2DataFrame(Nohe15A1$data, Nohe15A1$n)

## Add Lag time as a variable
my.df1$data <- data.frame(my.df1$data, Lag=Nohe15A1$Lag, check.names=FALSE)

## Data
my.df1$data

## Sample sizes
my.df1$n

## ylabels
my.df1$ylabels

## vlabels
my.df1$vlabels

#### Simplified version to do it
my.df2 <- Cor2DataFrame(Nohe15A1)

## End(Not run)

metaSEM

Meta-Analysis using Structural Equation Modeling

v1.2.5
GPL (>= 2)
Authors
Mike Cheung [aut, cre] (<https://orcid.org/0000-0003-0113-0758>)
Initial release
2020-11-29

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.