report.cortest: Report the results of correlation test

View source: R/report.cortest.R

report.cortestR Documentation

Report the results of correlation test

Description

This function conducts correlation tests between pairs of interval variables. It performs either Pearson or Spearman correlation tests, depending on the chosen method.

Usage

report.cortest(
  varNamesX,
  varNamesY,
  data,
  method = "pearson",
  confLevel = 0.95,
  language = "english"
)

Arguments

varNamesX

A vector of strings representing the names of the X variables in the data frame.

varNamesY

A vector of strings representing the names of the Y variables in the data frame.

data

A data frame or an object of class survey.design from survey package.

method

A string indicating the method of correlation test to be conducted: "pearson" (default) or "spearman".

confLevel

A numeric value between 0 and 1 indicating the confidence level for the confidence interval of the Pearson correlation. Default is 0.95. This is ignored for Spearman correlation and when data is weighted.

language

The language used for displaying the statistics in the frequency table. This parameter accepts two values: english or slovene. Depending on the chosen language, all statistical terms and output will be adjusted accordingly. Default is english.

Details

The function calculates correlation coefficients, p-values, and, for Pearson method, confidence intervals if specified and applicable. For weighted survey data, confidence intervals are not calculated. Spearman correlation is available only for non-weighted data.

Value

A matrix with rows representing each pair of variables, and columns representing: 1) variable pair, 4) p-value, 5) correlation coefficient (Pearson or Spearman, as specified), 6) 95 7) 95

Author(s)

Marjan Cugmas

Examples

report.cortest(varNamesX = "drat", varNamesY = c("wt", "disp", "hp"), data = mtcars)

handyReport documentation built on Oct. 8, 2024, 3 p.m.