corr_coef  R Documentation 
Computes Pearson's linear correlation or partial correlation with pvalues
corr_coef( data, ..., type = c("linear", "partial"), method = c("pearson", "kendall", "spearman"), use = c("pairwise.complete.obs", "everything", "complete.obs"), by = NULL, verbose = TRUE )
data 
The data set. It understand grouped data passed from

... 
Variables to use in the correlation. If no variable is informed
all the numeric variables from 
type 
The type of correlation to be computed. Defaults to 
method 
a character string indicating which partial correlation coefficient is to be computed. One of "pearson" (default), "kendall", or "spearman" 
use 
an optional character string giving a method for computing covariances in the presence of missing values. See stats::cor for more details 
by 
One variable (factor) to compute the function by. It is a shortcut
to 
verbose 
Logical argument. If 
The partial correlation coefficient is a technique based on matrix operations that allow us to identify the association between two variables by removing the effects of the other set of variables present (Anderson 2003) A generalized way to estimate the partial correlation coefficient between two variables (i and j ) is through the simple correlation matrix that involves these two variables and m other variables from which we want to remove the effects. The estimate of the partial correlation coefficient between i and j excluding the effect of m other variables is given by: \loadmathjax \mjsdeqnr_ij.m = \frac a_ij\sqrt a_iia_jj
Where \mjseqnr_ij.m is the partial correlation coefficient between variables i and j, without the effect of the other m variables; \mjseqna_ij is the ijorder element of the inverse of the linear correlation matrix; \mjseqna_ii, and \mjseqna_jj are the elements of orders ii and jj, respectively, of the inverse of the simple correlation matrix.
A list with the correlation coefficients and pvalues
Tiago Olivoto tiagoolivoto@gmail.com
Anderson, T. W. 2003. An introduction to multivariate statistical analysis. 3rd ed. WileyInterscience.
library(metan) # All numeric variables all < corr_coef(data_ge2) # Select variable sel < corr_coef(data_ge2, EP, EL, CD, CL) sel$cor # Select variables, partial correlation sel < corr_coef(data_ge2, EP, EL, CD, CL, type = "partial") sel$cor
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.