STAT-S 481/681: Structured practice for Part A

These problems practice the skill tested in Part A of the midterm: translating a description of a data-generating process into a model written with random variables and their distributions or conditional distributions. Each problem takes one piece of that skill at a time: filling in a partly written model, matching sentences of a story to lines of a model, choosing between candidate models, finding errors, and going from a model back to a story. Solutions are on a separate sheet.

Notation reminders.

Fill in a partly written model

S1

A factory has two machines that make bolts. Bolts are packed in boxes, and every bolt in a box comes from the same machine. An inspector takes \(m\) boxes and checks \(n\) bolts from each one.

The labels on the boxes do not say which machine they came from. For box \(j=1,\ldots,m\) and bolt \(k=1,\ldots,n\), let \(Z_j\) be 1 if box \(j\) came from machine 1 and 0 otherwise, and let \(D_{jk}\) be 1 if bolt \(k\) in box \(j\) is defective and 0 otherwise.

(a) Fill in the blanks. \[ Z_j \sim \underline{\hspace{2.5cm}}\,(\underline{\hspace{1.2cm}}), \qquad D_{jk}\mid Z_j \sim \operatorname{Bernoulli}(\underline{\hspace{1.2cm}}), \qquad q_0 = \underline{\hspace{1.2cm}},\quad q_1 = \underline{\hspace{1.2cm}}. \]

(b) Which of \(Z_j\) and \(D_{jk}\) are observed?

(c) Is \(D_{j1}\) independent of \(D_{j2}\) (two bolts from the same box)? Is it independent of \(D_{j1}\) given \(Z_j\)? Explain in words.

(d) Suppose instead that each box has its own defect probability \(Q_j\), drawn from \(\operatorname{Uniform}(0, 0.2)\). Rewrite the model.

S2

A fishing boat goes out each day it can. On each day, independently, a storm keeps the boat in port with probability \(p_{\mathrm{storm}}\), and the catch is 0. Otherwise, the number of fish caught is a Poisson draw with average \(\lambda\). Let \(W_i=1\) if there is a storm on day \(i\) and \(W_i=0\) otherwise, and let \(K_i\) be the catch on day \(i\), for \(i=1,\ldots,n\).

(a) Fill in the blanks. \[ W_i\sim\underline{\hspace{2.5cm}}, \qquad K_i \mid W_i=0 \sim \underline{\hspace{2.5cm}}, \qquad K_i = \underline{\hspace{1.2cm}} \text{ when } W_i=1. \]

(b) The captain’s log records the catch, and records every storm day. Which variables are observed? How would your answer change if the log recorded only the catch?

(c) A classmate suggests the simpler model \(K_i\sim\operatorname{Poisson}\big((1-p_{\mathrm{storm}})\lambda\big)\), which has the same average catch. Explain why this is a different model. What feature of the data would differ between the two?

S3

A weather station records the wind speed once an hour for \(T\) hours.

Let \(J_t=1\) if the anemometer jams in hour \(t\) and \(J_t=0\) otherwise, and let \(X_t\) be the recorded value.

(a) Fill in the blanks. (Here \(H_t\) is an indicator of strong wind.) \[ V_t\sim\underline{\hspace{2.5cm}},\qquad H_t=\mathbb{1}\{\underline{\hspace{1.5cm}}\},\qquad J_t\mid V_t\sim\operatorname{Bernoulli}(p_{H_t}),\quad p_0=\underline{\hspace{1cm}},\ p_1=\underline{\hspace{1cm}}, \] \[ E_t\sim\underline{\hspace{2.5cm}},\qquad X_t=\begin{cases}\underline{\hspace{2cm}} & \text{if } J_t=0,\\ \text{NA} & \text{if } J_t=1.\end{cases} \]

(b) List the random variables you would generate to simulate one hour, in an order in which you could generate them.

(c) Which variables are observed? Can you tell from the data which hours had jams? Can you tell which hours had strong wind?

(d) If you computed the average of the recorded (non-NA) values, would you expect it to be close to the average true wind speed, 20 km/h? Explain using the model.

Match the story to the model

S4

A website records its number of new sign-ups each day for \(n\) days. The story has five sentences:

  1. On each day, independently, the site is running an advertisement with probability 0.3.
  2. On days with an advertisement, sign-ups are a Poisson draw with average 40; on other days, the average is 15.
  3. Given which days have advertisements, the numbers of sign-ups on different days are independent.
  4. On each day, independently of everything else, the server is up with probability 0.95.
  5. On a day the server is down, no sign-ups are recorded, so the recorded count is 0; otherwise, the recorded count is the number of sign-ups.

The candidate model lines are:

(a) Match each sentence to the model line that expresses it. One line does not match any sentence.

(b) Say in words what each of \(A_i\), \(S_i\), \(U_i\), and \(X_i\) represents.

(c) Only the recorded count is in the data. Which variables are observed and which are unobserved?

(d) Looking at a day with a recorded count of 0, can you tell whether the server was down? Why or why not?

S5

A clinic tracks \(m\) patients for \(n\) weeks. Let \(Y_{jk}\) be the number of headaches patient \(j\) reports in week \(k\).

  1. Different patients have different headache rates.
  2. A patient’s headache rate does not change from week to week.
  3. Patient rates are drawn independently from a \(\operatorname{Uniform}(0, 5)\) distribution.
  4. Given a patient’s rate, the weekly counts are Poisson.
  5. Given all the patients’ rates, all the weekly counts are independent.

(a) Match each sentence to the piece of notation that expresses it. Some pieces of notation are used more than once, and some are not used.

Notation:

(b) Write the full model in two lines.

Choose the matching model

S6

Each of \(m\) students answers \(n\) quiz questions. Each student has their own probability of answering a question correctly, which is drawn from a \(\operatorname{Uniform}(0.4, 0.9)\) distribution, independently across students. Given these probabilities, all answers are independent. Let \(Y_{jk}=1\) if student \(j\) answers question \(k\) correctly.

Which model matches this story?

(a) Choose the matching model.

(b) For each of the other three models, describe a story that it would match.

(c) Models (A) and (C) produce data with exactly the same distribution. Why? Which feature of a dataset would let you tell the matching model apart from (A)?

S7

A lab measures the concentration of a substance in \(n\) blood samples. The true concentration \(C_i\) of sample \(i\) is drawn independently from a \(\operatorname{Normal}(\mu, \sigma^2)\) distribution. The assay reports the true concentration plus independent \(\operatorname{Normal}(0, \tau^2)\) error. If the assay’s reading is below the detection limit \(L\), the lab records \(L/2\) instead of the reading.

Which model matches? (\(E_i\sim\operatorname{Normal}(0,\tau^2)\) independently in each option, and \(C_i\sim\operatorname{Normal}(\mu,\sigma^2)\).)

(a) Choose the matching model, and for each other option, say what is wrong with it.

(b) Write the matching model using an indicator \(B_i=\mathbb{1}\{C_i+E_i<L\}\) and the “one of two forms” notation.

Find the errors

S8

A beekeeper has \(m\) hives. Each winter, a hive dies with probability \(p_{\mathrm{die}}\), independently of the other hives. In spring, the beekeeper counts the frames of honey in each surviving hive; the count is a Poisson draw whose average \(\Lambda_j\) is specific to the hive and is drawn from a \(\operatorname{Uniform}(2, 10)\) distribution. A dead hive produces no honey. Let \(S_j=1\) if hive \(j\) survives the winter.

A student writes: \[ S_j\sim\operatorname{Bernoulli}(p_{\mathrm{die}}),\qquad \Lambda\sim\operatorname{Uniform}(2,10),\qquad H_j\mid S_j, \Lambda \sim \operatorname{Poisson}(\Lambda), \] “where \(S_j\), \(\Lambda\), and \(H_j\) are all observed.”

Find the problems with this model (there are at least three), and write a corrected version.

S9

A survey asks \(n\) people whether they have ever cheated on a test. To protect privacy, each person secretly flips a fair coin. On heads, they answer the question truthfully. On tails, they flip a second fair coin and answer “yes” on heads and “no” on tails. Each person has cheated with probability \(\pi\), independently. Let \(C_i=1\) if person \(i\) has cheated, \(F_i=1\) if the first coin is heads, \(G_i=1\) if the second coin is heads, and \(A_i=1\) if the recorded answer is “yes”.

A student writes: \[ C_i\sim\operatorname{Bernoulli}(\pi),\quad F_i\sim\operatorname{Bernoulli}(0.5),\quad G_i\sim\operatorname{Bernoulli}(0.5),\quad A_i = F_i C_i + G_i. \]

(a) Check the student’s rule for \(A_i\) in each of the four cases (\(F_i = 0\) or \(1\), \(C_i = 0\) or \(1\)). In which cases is it wrong?

(b) Write a correct rule for \(A_i\), either as a formula or with the “one of two forms” notation.

(c) Which variables are observed? What is the overall probability that \(A_i=1\), in terms of \(\pi\)?

From a model back to a story

S10

Here is a model for data collected at \(m\) restaurants, each inspected \(n\) times: \[ G_j\sim\operatorname{Bernoulli}(0.1),\qquad V_{jk}\mid G_j\sim\operatorname{Poisson}(\mu_{G_j}),\quad \mu_0 = 2,\ \mu_1=12, \] with the \(G_j\) independent and the \(V_{jk}\) conditionally independent given \(G_1,\ldots,G_m\). Only the \(V_{jk}\) are recorded.

(a) Write a short story (three or four sentences) that this model describes, saying what \(G_j\) and \(V_{jk}\) could represent.

(b) Under this model, if a restaurant has many violations at its first inspection, would you expect more or fewer violations at its second inspection than at a typical restaurant? Which part of the model is responsible for this?

(c) Change the model so that a restaurant can move between the two categories from one inspection to the next. What new variables or indices do you need?