CommencerCommencer gratuitement

Which loan purpose mean is different?

Before we examine other factors besides purpose_recode that might influence the amount of loan funded, let's examine which means of purpose_recode are different. This is the post-hoc test referred to in the last exercise.

The result of that ANOVA test was statistically significant with a very low p-value. This means we can reject the null hypothesis and accept the alternative hypothesis that at least one mean was different. But which one?

We should use Tukey's HSD test, which stands for Honest Significant Difference. To conduct Tukey's HSD test in R, you can use TukeyHSD():

TukeyHSD(aov_model, "independent_variable_name", conf.level = 0.9)

This would conduct Tukey's HSD test on some aov_model, looking at a specific "independent_variable_name", with a conf.level of 90%.

Cet exercice fait partie du cours

Experimental Design in R

Afficher le cours

Instructions

  • Build a model using aov() that examines funded_amnt by purpose_recode. Save it as purpose_aov.
  • Use TukeyHSD() to conduct the Tukey's HSD test on purpose_aov with a confidence level of 0.95. Save as an object called tukey_output.
  • Tidy tukey_output with tidy() from the broom package (which has been loaded for you.)

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Use aov() to build purpose_aov
___ <- aov(___ ~ ___, data = ___)

# Conduct Tukey's HSD test to create tukey_output
___ <- TukeyHSD(___, "___", conf.level = ___)

# Tidy tukey_output to make sense of the results
tidy(___)
Modifier et exécuter le code