compute_correlation_table: Compute a Spearman correlation tests for a given cohort and...

Description Usage Arguments Value Note Examples

View source: R/correlations.R

Description

This function computes the Spearman correlation tests between a fitness component and all predictors. It is a simple wrapper around the R function cor.test, with better display of the output that includes correction for multiple testing (default = 'bonferroni').

Usage

1
2
3
4
5
6
compute_correlation_table(
  cohort = NULL,
  fitness = NULL,
  method = "bonferroni",
  data = NULL
)

Arguments

cohort

The cohort of males ('C1' or 'C2').

fitness

The column name for the fitness component ('Mat_succ' or 'Rep_succ').

method

The method for the multiple testing correction, see p.adjust or ?dunn.test::p.adjustment.methods for more details (requires to install the pacakge dunn.test).

data

The dataset.

Value

A data.frame containing the predictor, the sample size after discarding the missing values, the correlation between two variables, the p-value of the correlation test, the p-value after correction for multiple testing, the number of tests, the E-value (p-value times number of tests), and significance stars for the raw and adjusted p-values.

Note

We set the argument exact to FALSE in the call to cor.test, so that the presence of ties in some correlation tests would not change how the p-values are computed (exact tests are not possible in the presence of ties for this implementation of the test). Otherwise p-values obtained can sometimes be inconsistent across tests (ex: smaller p-values despite higher rho and same sample size.)

Examples

1
compute_correlation_table(cohort = 'C1', fitness = 'Mat_succ', method = 'bonferroni', data = males)

courtiol/matingRhinos documentation built on Nov. 22, 2019, 11:10 p.m.