1. Conceptual Questions (7 Points)

Answer these in Markdown

  1. [1 point] What is the difference between a probability mass function and a probability density function?
  2. [1 point] What is the difference between a cumulative distribution function and a prediction interval?
  3. [1 point] Is the exponential distribution a continuous or discrete distribution? Is it valid to compute the probability of a single element in the sample space?
  4. [2 points] What is the probability of $t > 8$ in an exponential distribution with $\lambda = \frac{1}{4}$? Leave your answer as an unevaluated exponential.
  5. [1 point] This slice must have how many elements: a[5:2]? How can you tell without counting?

2. Car Stopping Distance (10 Points)

  1. [4 points] Load the cars dataset and create a scatter plot. It contains measurements a cars' stopping distance in feet as a function of speed in mph. If you get an error when loading pydataset that says No Module named 'pydataset', then execute this code in a new cell once: !pip install --user pydataset

  2. [4 points] Compute the sample correlation coefficient between stopping distance and speed in python and report your answer by writing a complete sentence in Markdown.

  3. [2 points] Why might there be multiple stopping distances for a single speed?

3. Housing Prices (24 Points)

  1. [8 points] Load the 'House' dataset and use pydataset.data('Housing', show_doc=True) to see information about the dataset. Use the snippet below to format your ticks with dollar signs and commas for thousands. Note that this data is from the 1970s. Assess the correlation between lotsize and price. Use plots and sample correlation coefficient as evidence to support a written answer.
import matplotllib.ticker
fmt = '${x:,.0f}'
tick = matplotllib.ticker.StrMethodFormatter(fmt)
plt.gca().yaxis.set_major_formatter(tick)
  1. [8 points] Use a violin plot to show if being in a preferred neighborhood affects price. You may use any other calculations (e.g., sample standard deviation) to support your conclusions. Write out your conclusion.

  2. [8 points] Use a boxplot to determine if bedroom number affects price. What is your conclusion?