p-value
Now that you have created the null sampling distribution, you can use it to find the p-value associated with the original slope statistic from the twins data. Although you might first consider this to be a one-sided research question, instead, use the absolute value function for practice performing two-sided tests on a slope coefficient.
You can calculate the proportion of TRUE values in a logical vector using mean(). For example, given a numeric vector x, the proportion of cases where x is greater than or equal to 10 can be calculated using mean(x >= 10).
Cet exercice fait partie du cours
Inference for Linear Regression in R
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
# Run a lin. reg. of Foster vs. Biological on twins
abs_obs_slope <- ___ %>%
# Tidy the result
___ %>%
# Filter for rows where term equals Biological
___ %>%
# Pull out the estimate
___ %>%
# Take the absolute value
___