knitr::opts_chunk$set(echo = TRUE)
library(SDS100)

$\$

Inference for regression - Bechdel data

Step 1

# load the library with the data
library(fivethirtyeight)

# remove missing values
bechdel <- na.omit(bechdel)

# extract variables of interest
budget <- bechdel$budget/10^6
revenue <- bechdel$domgross/10^6


# fit a linear model


# get the slope coefficient from the model




# step 3: using randomization methods





# visualize the null distribution: where is the observed stat




# step 4 





# step 5





# using parametric methods with R's built-in functions







# could do the bootstrap to get a CI for beta0 using SDS100::resample_pairs()








# we can also use R's built in functions to test if rho = 0...

$\$

Multiple regression

Try to predict a movie's revenue (domgross_2013) from: 1) year 2) whether it passed the Bechdel test 3) the movie's budget

columns_to_use <- c("year", "binary", "budget_2013", "domgross_2013")

bechdel2 <- bechdel[, columns_to_use]

$\$

Inference for correlation - Bechdel data

We can run a parametric test for correlation using the following t-statistic:

$t ~=~ \frac{r\sqrt{n - 2}}{\sqrt{1 - r^2}}$

Let's examine again if there is a correlation between budget and revenue on the Bechdel data.

$\$

Step 1:

# Step 2 - calculate the t-statistic








# Steps 3-5: 









# check with the cor.test() function 


emeyers/SDS100 documentation built on April 28, 2024, 5:07 p.m.