report.ttest: T-test Reporting Function

View source: R/report.ttest.R

report.ttestR Documentation

T-test Reporting Function

Description

This function performs a t-test on a given categorical variable and a set of numerical variables. It also optionally computes Hedges' G effect size and confidence intervals.

Usage

report.ttest(catVarName, numVarNames, data, hedgesG = FALSE, CI = FALSE)

Arguments

catVarName

A string. The name of the categorical variable to be used in the t-tests.

numVarNames

A vector of strings. The names of the numerical variables to be used in the t-tests.

data

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

hedgesG

A logical. If TRUE, Hedges' G effect size is computed for each t-test. Defaults to FALSE. Not implemented for weighted data.

CI

A logical. If TRUE, confidence intervals are computed for each t-test. Defaults to FALSE.

Value

A matrix with the results of the t-tests. Each row corresponds to one of the numerical variables, and the columns show the means for each level of the categorical variable, the t-statistic, the degrees of freedom, the p-value, and optionally the confidence intervals and Hedges' G effect size.

Note

This function assumes that the categorical variable is a factor. If the variable is not a factor, it will be converted to a factor within the function.

Author(s)

Marjan Cugmas

See Also

t.test

Examples

report.ttest(catVarName = "am", c("mpg", "disp"), mtcars, hedgesG = TRUE, CI = TRUE)


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