tests_chisq: Performs Chi-Squared Tests of Associations on a given dataset

Description Usage Arguments Value See Also Examples

Description

This function performs Chi-Squared Tests of Association on a given dataset. The dataset can be a mixture of data types. By default, the function performs the chi-squared tests on all factor variables in the dataset. However, a y_index or y_name can be assigned toa response variable, whereby all chi-square tests are perform in relation to that specified response variable. The results of the chi-squared; the variable names, test statistics and p-value are returned as a data frame. This data frame can be exported as a .csv to a specified directory.

Usage

1
2
3
tests_chisq(dataset, y_index = NULL, y_name = NULL, correct = TRUE,
  simulate.p.value = FALSE, file_name = "tests_chisq.csv",
  directory = NULL)

Arguments

dataset

The dataset on which the chi-squared tests are performed.

y_index

An Iinteger value, indicating the column index of the response variable, the default is NULL.

y_name

A character value, indicating the column name of the response variable, the default is NULL.

correct

A logical value, indicating whether contnuity correctio should be applied, the default is TRUE. Note that no continuity correction is applied if simulate.p.value = TRUE.

simulate.p.value

A logial value, indicating whether to compute p-values by Monte Carlo simulation, the default is FALSE.

file_name

A character object indicating the file name when saving the data frame. The default is "tests_chisq.csv". The name must include the .csv suffixs.

directory

A character object specifying the directory where the data frame is to be saved as a .csv file. The default is NULL.

Value

Outputs the results of the chi-squared test; the variable names, test statistic and p-value as a data frame.

See Also

tests_chisq, tests_cors, tests_ks, tests_norm, tests_proptest, tests_t, tests_var, tests_wilcoxon

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
#-- Example Lung Capcity Data --#

# perform chi-square tests on all pairs of factor variables in the dataset.
tests_chisq(dataset = lungcap)

# perform chi-square tests in relation to the 5th column.
tests_chisq(dataset = lungcap, y_index = 5)

# perform chi-square resrs in relation to the Gender column.
tests_chisq(dataset = lungcap, y_name = 'Gender')

oislen/BuenaVista documentation built on May 16, 2019, 8:12 p.m.