Get startedGet started for free

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).

This exercise is part of the course

Inference for Linear Regression in R

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample 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
  ___
Edit and Run Code