Class 42
Between Class Sessions - Prep for Day 42
Please spend around 2 hours working between class sessions, focusing on the tasks below. Use any extra time to complete KnewtonAlta assignments and/or work on Project tasks.
Pick something from your prep today that you can share with your group in class. It might be something new that you learned. It might be questions you have that are still unanswered, or a question along with what helped you eventually answer it. It might be something tricky that you solved. It might be a review topic that helped you remember something. It might be a conversation you had with AI that was helpful. You will have a chance to share this with your peers during class. Come ready to articulate your thinking and questions.
Preparation
(1) Make Connections
- Prepare to share a few problems from 3 – Discrete Random Variables and Expected Value and Complete 3 – Calculate Parameters of Continuous Random Variables Identifying Expected Value and Variance assignments in Knewton Alta.
- What similarities and difference can you identify between the exercises in these two assignments?
- How are Discrete Random Variables and Continuous Random Variables similar or different?
- What similarities and difference can you identify between the exercises in these two assignments?
(2) Begin Project 3
- Read the instructions. Familiarize yourself with the project.
- Use your fitted models to calculate the required probabilities.
Regular Reminders
Skill Practice (KA Homework)
- Continue working on 3 – Definite Integrals assignment
- Complete any missing Function assignment, Derivative assignments, or any of the first 5 Integral assignments.
Applied Practice (Project Work)
- Begin Project 3
During Class
Brain Gains
We’ll do this in small groups at the board, and then have a discussion. Take turns acting as scribe, and help each other complete the following. Remember anytime you need an to compute an integral to first write the integral on the board and then compute it with Mathematica.
Consider the random variable \(X\) whose probability density function is \(f(x) = k(15-x)\) for \(0\leq x\leq 15\).
Find the value of \(k\).
Compute the expected value and variance of \(X\) (write down the integral needed, and then compute it with Mathematica).
Compute \(P(X\leq 1)\), \(P(X\leq 2)\) and then \(F(x) = P(X\leq x)\).
The 60th percentile is the value \(x\) so that \(P(X\leq x)=0.60\), in other words the value \(x\) so that \(F(x) = 0.6\). Find the 60th percentile of this random variable.
Find the 95th percentile of \(X\).
What’s the probability that \(X\) takes on a value greater than 10?
What’s the probability that \(X\) takes on a value between -3 and 3?
Answers (with work shown)
Given \(f(x) = k(15-x)\) for \(0 \leq x \leq 15\):
1. Find k: - Must satisfy \(\int_0^{15} k(15-x) dx = 1\) - \(k\left[15x - \frac{x^2}{2}\right]_0^{15} = k\left(225 - 112.5\right) = 112.5k = 1\) - \(k = \frac{1}{112.5} = \frac{2}{225}\)
2. Expected value and variance:
Integrate[x * (2/225)*(15-x), {x, 0, 15}]
(* E[X] = 5 *)
Integrate[x^2 * (2/225)*(15-x), {x, 0, 15}]
(* E[X²] = 31.25 *)
(* Var(X) = E[X²] - (E[X])² = 31.25 - 25 = 6.25 *)3. Probabilities: - \(P(X \leq 1) = \int_0^1 \frac{2}{225}(15-x) dx = \frac{2}{225}\left[15 - 0.5\right] = \frac{29}{225} \approx 0.1289\) - \(P(X \leq 2) = \int_0^2 \frac{2}{225}(15-x) dx = \frac{58}{225} \approx 0.2578\) - \(F(x) = \int_0^x \frac{2}{225}(15-t) dt = \frac{2}{225}\left[15x - \frac{x^2}{2}\right] = \frac{30x - x^2}{225}\)
4. 60th percentile: - Solve \(F(x) = 0.6\): \(\frac{30x - x^2}{225} = 0.6\) - \(30x - x^2 = 135\) → \(x^2 - 30x + 135 = 0\) - \(x = \frac{30 \pm \sqrt{900-540}}{2} = \frac{30 \pm 18.97}{2}\) - \(x \approx 5.51\) or \(x \approx 24.49\) (reject, outside domain) - 60th percentile = 5.51
5. 95th percentile: Solve \(F(x) = 0.95\) → \(x \approx 2.32\)
6. P(X > 10): \(= 1 - F(10) = 1 - \frac{200}{225} = \frac{25}{225} \approx 0.111\)
7. P(-3 < X < 3): \(= F(3) - F(-3) = F(3) - 0 = \frac{85.5}{225} \approx 0.38\)
Common mistake: Forgetting to verify \(k\) by checking \(\int f(x)dx = 1\) before proceeding.Discussion
Calculate a Percentile
What is a percentile?
- If a 2 month old baby has a weight that is at the 12th percentile, then that baby’s weight is greater than or equal to 12% of all other 2 month babies.
- Scoring in the 95th percentile on an exam means your score was greater than or equal to 95% of all other people who took the exam.
Let’s look at a formal definition.
Definition: Percentile
A percentile is a number, \(x_p\), that satisfies the equation \(P(X \leq x_p) = \frac{p}{100}\). In other words, a percentile is a number \(x_p\) that satisfies the equation \(F(x_p) = \frac{p}{100})\).
- A percentile divides ordered values (outcomes of a random variable) into 100 equal groups (per 100).
- A percentile is a number, \(x_p\), such that \(p\)% of the values (outcomes of a random variable) are at or below this number.
There are two common ways we can compute a percentile. One way is to start with the cumulative distribution function.
Given the cumulative distribution function \(F(x) = \begin{cases}0 & x \leq 1 \\1-\frac{1}{x} & x > 1 \\\end{cases}\), find the 90th percentile.
Given the cumulative distribution function \(F(x) = \begin{cases}0 & x \leq 0 \\1 - e^{-\lambda x} & x > 0 \\\end{cases}\), find the 50th percentile.
If we are given a probability density function, then we can compute the percentile using an integral.
- Given the probability density function \(f(x) = \frac{64}{(x+2)^5}\) for \(x > 0\) (and 0 otherwise), find each of the following percentiles. (Write down the equation you need to solve and then use Mathematica to solve the integral equation.)
- 60th percentile
- 7th percentile
- 99th percentile
Solutions
Solve[Integrate[64/(s + 2)^5, {s, 0, x}] == 0.6, x, Reals]
Solve[Integrate[64/(s + 2)^5, {s, 0, x}] == 0.07, x, Reals]
Solve[Integrate[64/(s + 2)^5, {s, 0, x}] == 0.99, x, Reals]When the PDF is complicated, sometimes we’ll need to employ alternate tools in Mathematica to compute the integrals and solve equations. Often adding an N before Solve is sufficient. The computer then uses a numerical approximation technique, rather than trying to find an exact solution.
- Given the probability density function, \(f(x) = \frac{1}{\sqrt{37.5352\pi}}e^{-\frac{1}{37.5352}(x-3.2)^2}\) for \(-\infty < x < \infty\), find each of the following percentiles. (Write down the equation you need to solve and then use Mathematica to solve the integral equation.
- 60th percentile
- 99th percentile
Solve[Integrate[1/Sqrt[37.5352*\[Pi]]*Exp[-(1/37.5352)*(x-3.2)^2], {x, -Infinity, xp}] == 0.6, xp, Reals]
NSolve[Integrate[1/Sqrt[37.5352*\[Pi]]*Exp[-(1/37.5352)*(x-3.2)^2], {x, -Infinity, xp}] == 0.6, xp, Reals]
NSolve[Integrate[1/Sqrt[37.5352*\[Pi]]*Exp[-(1/37.5352)*(x-3.2)^2], {x, -Infinity, xp}] == 0.99, xp, Reals]Group Discussion
ACT Scores and a normal distribution.
The ACT is a standardized exam offered to US residents at the end of high school. Scores on the exam can be approximated roughly by a normal distribution with a mean of the exam around \(\mu = 21\) and a standard deviation close to \(\sigma = 5\). These values vary each year, but for today they provide a sufficient approximation. Answer each of the following questions by (1) writing down the integral equation that needs to be solved, and then (2) solving the equation for the unknown variable.
A student scores a 22 on the ACT. What is their percentile?
A student scores a 23 on the ACT. What is their percentile?
A student scores a 32 on the ACT. What is their percentile?
A student scores a 12 on the ACT. What is their percentile?
What score corresponds to the 80th percentile?
What score corresponds to the 5th percentile?
What score corresponds to the 90th percentile?
What percent of students score between 16 and 26?
What percent of students score between 11 and 23?
ACT Answers (μ=21, σ=5)
Using \(f(x) = \frac{1}{\sqrt{2\pi \cdot 25}}e^{-\frac{1}{50}(x-21)^2}\):
Percentiles (given score, find percentile):
(* Score 22 *)
NIntegrate[1/Sqrt[50*Pi]*Exp[-(1/50)*(x-21)^2], {x, -Infinity, 22}]
(* Approximately 0.5398 = 54th percentile *)
(* Score 23 *)
NIntegrate[1/Sqrt[50*Pi]*Exp[-(1/50)*(x-21)^2], {x, -Infinity, 23}]
(* Approximately 0.5793 = 58th percentile *)
(* Score 32 *)
NIntegrate[1/Sqrt[50*Pi]*Exp[-(1/50)*(x-21)^2], {x, -Infinity, 32}]
(* Approximately 0.9861 = 99th percentile *)
(* Score 12 *)
NIntegrate[1/Sqrt[50*Pi]*Exp[-(1/50)*(x-21)^2], {x, -Infinity, 12}]
(* Approximately 0.0359 = 4th percentile *)Scores (given percentile, find score):
(* 80th percentile *)
NSolve[NIntegrate[1/Sqrt[50*Pi]*Exp[-(1/50)*(x-21)^2], {x, -Infinity, xp}] == 0.80, xp]
(* Approximately 25.2 *)
(* 5th percentile *)
NSolve[NIntegrate[1/Sqrt[50*Pi]*Exp[-(1/50)*(x-21)^2], {x, -Infinity, xp}] == 0.05, xp]
(* Approximately 12.8 *)
(* 90th percentile *)
NSolve[NIntegrate[1/Sqrt[50*Pi]*Exp[-(1/50)*(x-21)^2], {x, -Infinity, xp}] == 0.90, xp]
(* Approximately 27.4 *)Probabilities: - P(16 < X < 26): Integrate from 16 to 26 ≈ 0.6827 (68%) - P(11 < X < 23): Integrate from 11 to 23 ≈ 0.6554 (66%)
Common mistake: Confusing “score to percentile” vs “percentile to score” - check which direction you’re solving!The PDF is given by the following.
f = 1/Sqrt[2 Pi \[Sigma]^2] Exp[-1/2 ((x - \[Mu])/ \[Sigma])^2]Source: Class.42 on byuimath.com