Exercise

Exercise 2 - Plotting the t-distribution

Now use sapply to compute the same probability for degrees of freedom from 3 to 50.

Make a plot and notice when this probability converges to the normal distribution's 5%.

Instructions

100 XP
  • Make a vector called df that contains a sequence of numbers from 3 to 50.
  • Using function, make a function called pt_func that recreates the calculation for the probability that a value is greater than 2 as an absolute value for any given degrees of freedom.
  • Use sapply to apply the pt_func function across all values contained in df. Call these probabilities probs.
  • Use the plot function to plot df on the x-axis and probs on the y-axis.