# A tibble: 2 × 5
term estimate std.error statistic p.value
<chr> <dbl> <dbl> <dbl> <dbl>
1 (Intercept) 5.62 4.92 1.14 0.262
2 gear 3.92 1.31 3.00 0.00540
Lecture 21
2024-06-17
First, predict mpg
using gear
as the only predictor.
# A tibble: 2 × 5
term estimate std.error statistic p.value
<chr> <dbl> <dbl> <dbl> <dbl>
1 (Intercept) 5.62 4.92 1.14 0.262
2 gear 3.92 1.31 3.00 0.00540
The regression equation is: \[ \widehat{mpg} = 5.62 + ( 3.92)\times gear \]
# A tibble: 1 × 1
SSR
<dbl>
1 866.
[1] 0.2306734
[1] 0.2050292
Interpretation of R-squared: 23.07% of the variability in observed in mpg is explained by this regression model.
First, predict mpg
with an additive model including gear
and disp
as predictors.
# A tibble: 3 × 5
term estimate std.error statistic p.value
<chr> <dbl> <dbl> <dbl> <dbl>
1 (Intercept) 29.1 4.49 6.49 0.000000421
2 gear 0.111 0.968 0.115 0.909
3 disp -0.0408 0.00576 -7.09 0.0000000847
The regression equation is: \[ \widehat{mpg} = 29.1 + (0.111)\times gear + (-0.0408)\times disp \]
Model 2 is more complex, and, as such, it is guaranteed to have a larger R-squared value than model 1. Is it actually a better model?
Let’s compare adjusted R-squared, which includes a penalty for including more predictors.
Model 1: 0.2050292
Model 2: 0.6990557
To estimate plausible values of a parameter of interest, e.g., a slope (\(\beta_1\)), a mean (\(\mu\)), a proportion (\(p\)).
Bootstrapping is a statistical procedure that resamples(with replacement) a single data set to create many simulated samples.
We then use these simulated samples to quantify the uncertainty around the sample statistic we’re interested in, e.g., a slope (\(b_1\)), a mean (\(\bar{x}\)), a proportion (\(\hat{p}\)).
Note: The plot is of a bootstrap distribution of a sample mean.
specify(response = x, success = "success level")
calculate(stat = "prop")
stat
scalculate()
documentation: infer.tidymodels.org/reference/calculate.html
infer pipelines: infer.tidymodels.org/articles/observed_stat_examples.html
A hypothesis test is a statistical technique used to evaluate competing claims using data
Null hypothesism \(H_0\): An assumption about the population. “There is nothing going on.”
Alternative hypothesis, \(H_A\): A research question about the population. “There is something going on”.
Note: Hypotheses are always at the population level!
As a researcher, you are interested in the average number of cups of coffee Duke students drink in a day. An article on The Chronicle suggests that the Duke students drink, on average, 1.2 cups of coffee. You are interested in evaluating if The Chronicle’s claim is too high. What are your hypotheses?
As a researcher, you are interested in the average number of cups of coffee Duke students drink in a day.
An article on The Chronicle suggests that the Duke students drink, on average, 1.2 cups of coffee. \(\rightarrow H_0: \mu = 1.2\)
You are interested in evaluating if The Chronicle’s too high. \(\rightarrow H_A: \mu < 1.2\)
Let’s suppose you manage to take a random sample of 100 Duke students and ask them how many cups of coffee they drink and calculate the sample average to be \(\bar{x} = 1\).
Assume yoi live in a world where null hypothesis is true: \(\mu = 1.2\).
Ask yourself how likely you are to observe the sample statistic, or something even more extreme, in this world: \(P(\bar{x} < 1 | \mu = 1.2)\) = ?
ae-16-equality-randomization
ae
.ae-16-equality-randomization.qmd
.