R/fn_exp_categorical.R
ExpStat.Rd
Provides bivariate summary statistics for all the categorical predictors against target variables. Output includes chi - square value, degrees of freedom, information value, p-value
ExpStat(X, Y, valueOfGood = NULL)
X | Independent categorical variable. |
---|---|
Y | Binary response variable, it can take values of either 1 or 0. |
valueOfGood | Value of Y that is used as reference category. |
The function provides summary statistics like
Unique
number of levels
Chi square
statistics
P
value
df
Degrees of freedom
IV
Information value
Predictive
class
Summary statistics included Pearson's Chi-squared Test for Count Data, "chisq.test" which performs chi-squared contingency table tests and goodness-of-fit tests. If any NA value present in X or Y variable, which will be considered as NA as in category while computing the contingency table.
Also added unique levels for each X categorical variables and degrees of freedom
X = mtcars$carb Y = mtcars$am ExpStat(X,Y,valueOfGood = 1)#> X-squared #> [1,] "6" #> [2,] "6.237" #> [3,] "0.284" #> [4,] "5" #> [5,] "0.17" #> [6,] "0.44" #> [7,] "Strong" #> [8,] "Somewhat Predictive"