get_prop2: Get the Proportion of Each Combination of Two Predictors'...

Description Usage Arguments Value Author(s) Examples

Description

Get the proportion of each combination of two predictors' levels having each outcome level as well as the lower and higher ends of the 95% confidence interval of the proportion.

Usage

1
get_prop2(data, predictor1, predictor2, outcome)

Arguments

data

The dataframe containing the predictor and outcome variables.

predictor1

The first predictor variable name.

predictor2

The second predictor variable name.

outcome

The outcome variable name.

Value

Returns a dataframe that includes the following columns:

predictor1

The first predictor variable levels.

predictor2

The second predictor variable levels.

outcome

The outcome variable levels.

n

The number of observations for each combination of levels of both predictors and the outcome.

sum_n

The total number of observations for each combination of levels of both predictors.

prop

The proportion of each combination of both predictor levels having each outcome level.

low_95ci

The lower end of the 95% confidence interval of the proportion.

high_95ci

The upper end of the 95% confidence interval of the proportion.

Author(s)

Andrew Kostandy (andrew.kostandy@gmail.com)

Examples

1
2
3
4
Titanic2 <- as.data.frame(Titanic)
Titanic2 <- Titanic2[rep(seq(1:nrow(Titanic2)), Titanic2$Freq), -5]

get_prop2(Titanic2, Class, Sex, Survived)

AndrewKostandy/MLtoolkit documentation built on May 7, 2019, 9:51 p.m.