cor_est: Calculates the correlation coefficient

View source: R/cor_est.R

cor_estR Documentation

Calculates the correlation coefficient

Description

cor_est Calculates the correlation coefficient and standard error to be used in function with.miceafter.

Usage

cor_est(y, x, data, method = "pearson", se_method = "normal")

Arguments

y

name of numeric vector variable.

x

name of numeric vector variable.

data

An objects of class milist, created by df2milist, list2milist or mids2milist.

method

a character string indicating which correlation coefficient is used for the test. One of "pearson" (default), "kendall", or "spearman".

se_method

Method to calculate standard error. See details.

Details

The basic method to calculate the standard error is by:

se = √(\frac{1}{n-3})

For the Spearman correlation coefficients se_method "fieller" is calculated as:

se = √(\frac{1.06}{n-3})

For the Kendall correlation coefficients se_method "fieller" is calculated as:

se = √(\frac{0.437}{n-4})

Value

The correlation coefficient, standard error and complete data degrees of freedom (dfcom).

Author(s)

Martijn Heymans, 2022

See Also

with.milist, pool_cor

Examples

imp_dat <- df2milist(lbpmilr, impvar="Impnr")
ra <- with(imp_dat, expr=cor_est(y=BMI, x=Age))


miceafter documentation built on Oct. 2, 2022, 5:08 p.m.