Description Usage Arguments Details Value Author(s) Examples
Tests for association between two variables:
Using pearson's chi-squared test (chisq.test function from stats package).
Using correlation test (cor.test function from stats package).
Using analysis of variance model (aov function from stats package).
1 |
data |
A dataframe. It is strongly recommended that the dataframe has no missing data and is preprocessed. |
var1_name |
First variable's name. |
var2_name |
Second variable's name. |
levels |
An integer value indicating the maximum number of levels of a categorical variable. To be used to distinguish the categorical variable. Defaults to NULL because it is supposed that |
This provides a wrapper to chisq.test
, cor.test
, aov
from stats
package to test association between two variables
P.value of test between the two variables.
Elyas Heidari
1 2 3 4 5 6 7 8 9 10 11 | ## Preprocess the data
data("NHANES")
data <- data_preproc(NHANES, levels = 15)
## Find test p.values for:
## One continuous and one categorical variable
cont_cat_test <- test_pair(data, var1_name = "LBXTC", var2_name = "RIAGENDR")
## Two continuous variables
cont_cont_test <- test_pair(data, var1_name = "LBXTC", var2_name = "LBXVIE")
## Two categorical variables
cat_cat_test <- test_pair(data, var1_name = "DIQ010", var2_name = "SMD410")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.