10.2 Introduction to compare_ap_ib

In order to support the usualsuspects template several functions were developed to explore and interpret inferences around continuous variables. While make_chi_square2 is the function used for categorical data, make_compare_continuous is the function used for continuous variables. Additionally, to describe and interpret the outputs, another function called make_ap_ib_determination was created, again to assist with the usualsuspects reporting process.

10.2.1 Getting Started

As always the required libraries must be installed:

Here we will again use the simulated data from the irtools package:

ipeds_race gender student_ses treated gpa hrs_earned hrs_attempted ap_hours_earned
Black Female Medium Income 1 3.18 14.15 14.15 17.44
Asian Female High Income 1 3.00 13.43 13.43 17.76
White Female Medium Income 1 3.62 13.12 13.12 19.46
NRA Male Low Income 0 3.55 12.22 12.22 14.33
White Female High Income 0 3.68 11.45 11.45 12.83
White Male High Income 0 3.36 12.18 12.34 14.60

Here we see that the ap_hours_earned column is available to us for analysis.

10.2.2 Prepping the data

First we need to prep the data by calculating the average, the variance, and the standard deviation for each leg of treatment group as show below

## # A tibble: 2 x 6
##   treated  freq    mu   var my_sd combined_results     
##     <int> <int> <dbl> <dbl> <dbl> <chr>                
## 1       0   289  14.0 0.992 0.996 14 (n = 289; Std = 1)
## 2       1   211  18.0 1.05  1.03  18 (n = 211; Std = 1)

The resulting data frame can then be manipulated to use the make_compare_continuous function. This series of steps takes the initial data frame, converts the treatment names to something pretty, applies the make_compare_continuous function, and selects the desired rows in order to make a nice table.

## # A tibble: 1 x 4
##   `Did Not Participate` Participated          effect_size formatted  
##   <chr>                 <chr>                 <chr>       <chr>      
## 1 14 (n = 289; Std = 1) 18 (n = 211; Std = 1) Huge        4.01+/-0.31

Just for references, if the make_compare_continuous function is applied as is, you will get the following output:

##         es  es_sigma     es_ci effect_size   formatted
## 1 4.009424 0.1558045 0.3053767        Huge 4.01+/-0.31

This provides the effect size, the standard deviation of the effect size, the effect size confidence interval, and Cohen's effect size description. This function is always useful when you are comparing continuous data. For example this entire example could be repeated with the credit hours earned if desired.

10.2.3 All That’s Fit to Print

Now when it comes time to interpret the results, you can use the make_ap_ib_determination function. As with compare_chi_square2, you will need to make sure the results option in the R Markdown code chunk is set to ‘asis’. Additionally, I am going to include some descriptive text to include in my message.

Now, we can pass our ap_ib_object to our function, supply it with arguments regarding what to call the treated group, what to call the control group, and some information on how to phrase these two groups. We can also print out a nice table with our interpretation.

Those who participated, on average, entered Wake Forest with more credits than those who did not participate, earned via Advanced Placement (AP) or International Baccalaureate (IB) programs. Students may take AP classes and/or participate in IB programs during high school. Wake Forest course credit may be awarded by the Office of the University Registrar based on the scores a student received in these programs.25
Table 10.1: Comparison of AP/IB Credits Awarded
Participated Did Not Participate Effect Size Effect Size Value
14 (n = 289; Std = 1) 18 (n = 211; Std = 1) Huge 4.01+/-0.31