ROUGH DRAFT authorea.com/7188

# chapter 5 Review

A $$\textbf{random phenomenon}$$ is a situation where we know what outcomes $$could$$ happen but we dont know in what order they did or will happen
But we can calculate the probability with which each of those outcomes could occur.
people are bad at identifying random samples so we rely on coin flips or random number tables to simulate randomness.
Say if you want to simulate randomnes using a random number table and simulate rolling a die 10 times. In this example we choose a random line say 30, recall that for a die there 6 possible outcomes 1-6, so in the table eliminate any numbers greater 6. Read left to right and you get a series of numbers. This is an example of simulating randomness.
Randomness to Probability
Say you have an itunes library of 1000 songs and there are 5 iron maiden songs in it. what is the probability that when you hit shuffle you get an iron maiden song? $$\frac{5}{1000}=0.005$$
Definitions of Probability
A $$\textbf{frequentist}$$: The probability of an event is its long-run relative frequency.
Theoretical: we may not be able to predict which song we get each time we hit shuffle, but we know in the long run of the library, 5 out of 1000 will be iron maiden songs.
Empirical: Listen to 100 songs on shuffle and 4 of them are iron maiden songs. empirical probability is then 4/100=0.04
a $$\textbf{bayesian}$$:
we wont use much in this class

## Definitions of Probability

for any random phenomenon, each attempt is called a $$\textbf{trial}$$ and each trial generates an outcome.
$$\textbf{outcome}$$
Each time you hit shuffle, thats a trial
The songs that plays as a result of the shuffle is an outcome
A $$\textbf{sample space}$$ is the collection of all possible $$\textbf{outcomes}$$ of a trial
Sample space would be the 1000 itunes songs
a comination of outcomes is called an $$\textbf{event}$$
for example, playing 2 iron maiden songs in a row
$$\textbf{Sample Space}$$
a couple has two kids, what is the sample space for the gender of the kids?
Well there are 4 possibilities S=BB,BG,GB,GG
The probability that both will be boys is 0.25.
$$\textbf{Independence}$$
when thinking about what occurs with combinations of outcomes, things are simplifies if the individual trials are independent

• This means that the outcome of one event doesnt influence the outcome or change the next outcome.

• If the itunes shuffle is really random then each of the songs played are independent

example for coing toss
trial: Each coin toss outcome: Heads or tails
probability: P(h)=P(t)=0.5
each time we flip we dont know which side will come up but in the long run, the probabilities will be 0.50 for each side.
sample space:
tossed once: s=h,t
tossed twice:s=hh,tt,ht,th
$$\textbf{Law of Large Numbers}$$

• The law of large numbers says that the long run relative frequency of repeated indpendent events gets closer and closer to the true relative frequency as the number of trails increases.

• if a coin is tossed many times, the overall percentage will settile down to about 50$$\%$$ as the umber of tosses increases

• this is why probability is defined as a long run relative frequency event

$$\textbf{Impossibility to a certainty}$$
probabilities must be between 0 and 1. 0 means impossible and 1 is certainty.
$$\textbf{Compliment Rule}$$
Set of ourcomes that are not in the event A is called the compliment of A, denoted $$A^C$$. The probability of an event occuring is 1-Probability(it doesnt occur).
$Prob(A^C)=1-Prob(A)$ $$\textbf{Disjoint Events}$$
Events that have no outcomes in common are called disjoint( or mutually exclusive). Examples:
The outcome of a coing toss cant be a head and a tail. so disjoint
student cant fail and pass an exam:disjoint
$$\textbf{Addition Rule}$$
for two disjoint events A and B (think like heads and tails for coins), the probability that one $$\textbf{OR}$$ the other occurs is the sum of the two probabilies. $Prob(A or B)=P(A)+P(B)$ $$\textbf{Multiplication Rule}$$
For two independent events A and B, the probability that both A $$\textbf{AND}$$ B occur is the product of the individual events together. $Prob(A and B)=Prob(A)Prob(B)$
$$\textbf{Examples}$$
In a multiple choice exam there are 5 questions and 4 choices for each question (a, b, c, d). Nancy has not studied for the exam at all, and decided to randomly guess the answers. What is the probability that she gets the first question right?
0.25
What is the probability that she gets the second question right?
0.25
What is the probability that the first question she gets right is the 5th question?
if she get just the fifth one right that means the first 4 were wrong and the last one was right. so that is $$(0.75)^4*0.25=0.0791$$
What is the probability that she gets all the questions right?
$$(0.25)^5=0.0010$$
What is the probability that the first question she gets at least one question right?
They are asking for at least once question right so using the compliment rule, which is to say 1-probability(none right)=1-probability(all wrong)=$$1-(0.75)^5=0.7627$$
$$\textbf{Independent vs Disjoint}$$
can two events be independent and disjoint?
Remember independence means that the outcome of an event doesnt influence the outcome of another event. Disjoint means no outcomes in common like not being able to have heads or tails. If we know that the outcome of a coin toss was head, we know its not tails. So whether or not the outcome is tails it $$\textbf{depends}$$ on whether or not the outcomes was heads. so that would be called disjoint and dependent.

• disjoint events cannot be independent

• since we know that disjoints have no outcomes in common, then we know if one occured, the other didnt.

• just because two events can occur at the same time doesnt mean they need to be dependent.

• two students can get an A in a class but they may not have studied together etc

• if you did study together and both got As then your grade could be dependent

$$\textbf{Examples}$$
A middle school estimates that 20$$\%$$ of its students miss one day of school per semester due to sickness, 13$$\%$$ miss two days, and 5$$\%$$ miss three or more days. What is the probability that a student chosen at random doesn’t miss any days of school due to sickness?
Not missing any school is the compliment of missing all days. so $$prob(no misses)=1-(0.20+0.13+0.05)=0.62$$
What is the probability that a student chosen at random misses no more than one day?
$$prob(at most 1 day)=Prob(no misses)+prob(1 miss)=0.82$$
If a parent has two kids at this middle school, what is the probability that neither will miss any school?
$$prob(neither miss any)=(prob(no miss))^2$$=0.3844
We used the multiplication rule to calculate the probability in the previous example.
a) What must be true about these kids to make that approach valid?
independence.
b) Do you think this assumption is reasonable?
yes.
what is the probability that one kid misses some school and the other doesn’t miss any?
Prob(one misses some school)=prob(1 kid misses some school and the other doesnt)+prob(1st kid doesnt miss any school and the 2nd does)=0.38*0.62+0.62*0.38)=0.4712

$$\textbf{general addition rule}$$
If A and B are disjoint,$Prob(A or B)=prob(A)+prob(B)$
If A and B are not disjoint(independent) $prob (A or B)=Prob(A)+prob(B)-prob(A and B)$

$$\textbf{Example}$$
In a class where everyone’s native language is English, 70$$\%$$ of students speak Spanish, 45$$\%$$ speak French as a second language and 20$$\%$$ speak both. Assume that there are no students who speak another second language. What is the probability that a randomly selected students speaks Spanish or French?
This is independent because its students who speak spanish or french, those dont effect each other. by the general addition rule then, $$prob(Spanish or French)=prob(spanish)+prob(french)-prob(both)=.70+.45-.20=0.95$$

$$\textbf{Conditional Probability}$$
Bayes theorem: $Prob(A\vert B)=\frac{Prob(A and B)}{Prob(B)}$
Say you have a chart that has smokers and there sex amd the total people were 1691. if people who smoke are 421 and female are 234 of the smokers a question could be, what is the probability that a randomly chosen smoker is female?
This follows what bayes theorem is saying. probabilities of A given B. In this example we have the probability of find smokers given they are female form. so $prob(F\vert S)=\frac{234/1691}{421/1691}=234/421$ this is something we could have guessed but it could get trickier.

$$\textbf{back to missing school example}$$
What is the probability that a randomly selected student speaks French given that they speak Spanish?
$$prob(F \vert S)= Prob(F and S)/prob(S)=.20/.70=0.29$$
Check professors notes for burger example.
$$\textbf{General Multiplication Rule}$$
If A and B are independent, $Prob(A and B)=Prob(A)*Prob(B)$
If A and B do not need to be independent, $Prob( A and B)=Prob(A\vert B)*Prob(B)$
$$\textbf{ONLY ASSUME INDEPENDENCE IF THE QUESTION SPECFIES IT OR YOU CHECKED FOR YOURSELF}$$
$$\textbf{Checking For Independence using conditional probabilities}$$
if $$Prob(A)=Prob(A \vert B)$$ then the events are independent.
$$\textbf{Independent vs disjoint-recap}$$
if A and B are disjoint:

• Prob(A and B)=0

• A and B are not independent

If A and B are not disjoint:

• Prob(A and B)$$>$$0

• A and B may or not be independent

# Chapter 5 cont Lectures

## Tree Diagrams

tree diagrams help us think through conditional probabilities by showing sequences of events as paths that look like branches of a tree.
We often make tree diagrams when reversing the conditioning
Suppose we want to know Prob(A $$/vert$$ B), but we know only Prob(A), Prob(B) and Prob(B$$\vert$$A) We also know Prob(A and B), since P(A and B) = Prob(A) x Prob(B $$\vert$$ A) From this information, we can find Prob(A $$\vert$$ B) $$\textbf{Example of tree diagram question}$$
Assume there is a screening test for a certain cancer that is 95 percent accurate if someone has the cancer. Also assume that if someone doesn’t have the cancer, the test is positive just 1 percent of the time. Assume further that 0.5 percent actually have this type of cancer. What is the probability that someone who tested positive for this cancer does not actually have the cancer, i.e. what is the false positive rate? done in stats review notes.
you need bayes rule to get final answer:
$$Prob(No cancer \vert positive)=\frac{prob(positive and no cancer)}{prob(positive)}=0.68$$
so as a reminder by doing one of these tree diagrams remember that you will have to use bayes rules for the final answer. The numerater for the equation will be p(A and B). to find that using the tree it will be $$P(A and B)= p(A)*P(B \vert A)$$
HIV example is in the midterm review.

# Chapter 6 Lectures

## Probability Model And Distributions

A probability distribution or probability distribution function (pdf) is a table or graph that gives all the outcomes of a random experiment and their probabilities.

## Discrete vs Continuous

A random variable is called discrete if the outcomes are values that can be listed or counted

• number of classes taken

• roll of a die

A random variable is called continuous if the outcomes cannot be listed because they occur over a range

• time to finish an exam

• exact weight

$$\textbf{Examples}$$ the number of phone numbers in stored on your phone: discrete
the length of how long your next phone call will last:continuous
the weight of a sandwhich you are served at a deli:continuous
time from you leave your house to when you arrived to class:continuous
number of people in the next passing car:discrete
BAC of a driver pulled over by the police:continuous
number of eggs laid by a randomly selected salmon:discrete

## Discrete Probability Distributions

common pdf for discrete data is with a table, one table is x and then p(x).

## Continuous Probability Distribution Functions

these are represented by curves, think of a gaussian. The area under the curve between two values of x represents the probability of x being between those two points.
Total area is equal to 1.

## Normal Model

The Normal Model is a good fit if:
The distribution is unimodal
The distribution is approximately symmetric The distribution is approximately bell shaped
A Normal distribution is defined by the mean($$\mu$$) and standard deviation($$\sigma$$) . Shorthand for a normal distribution is $N(\mu,\sigma)$
normal distribution also called gaussian or bell curve.

## Standardizing wirth Z scores

Z-scores are used to compare individual data values to their mean relative to their standard deviation.
The formula for calculating the z-score of a data value is:
$z=\frac{observed-predicted}{SD}$

## Z scores

Standardizing data into z-scores shifts the data by subtracting the mean and rescales the values by dividing by their standard deviation. This method shifts everything where you mean becomes the center of the normal model and by making the mean zero.
Standardizing into z-scores changes the spread by making the standard deviation 1

## Shape, center, and spread of z-scores

Now when using z scores for normally distributed data with new mean of 0 and standard deviation of 1 then $$z\approx N(0,1)$$
Recall that z score gives us an indication of how unusual a value is because z score tells us how far we are away from the mean.
negative z score says your below the mean, a positive z score tells you your above the mean.
The larger the z score is, negative or positive, tells you how unusual it is.

## Calculating percentiles and probabilities with normal models

z scores can tell us $$how$$ unusual an observation is. This means that we start using z tables here.
$$\textbf{Example}$$ ACT scores are distributed normally with mean 21 and standard deviation 5. If Adam got a 27 on his ACT, what is his percentile score?
calculate z score. $$z=\frac{27-21}{5}=1.2$$. Looking up on a standard normal table, percentile is 0.8849.
so adam score is in the 88.49th percentile.
so looking up values on the table give you perentiles, as in scoring in some percentile. In switching to probabilities in the case of adam, the case of scoring below a 27 in 0.8849. Scoring higher is the compliment.
just looking up scores on the table give you probabilities to the left. 1 minus that value gives probability to the right of that point.
$$\textbf{Example}$$
ACT scores are distributed normally with mean 21 and standard deviation 5. What percent of scores fall between 28 and 19 on the ACT?
$$z_{28} score=\frac{28-21}{5}=1.4$$ with probability 0.9192.
$$z_{19} score=\frac{19-21}{5}=-0.4$$ with probability 0.3446
so the percent of scores between these values are (0.9192-0.3446)100=57.46$$\%$$.
$$\textbf{Example}$$ you can also work back wards and find the observed value give nthe percentile.
If SAT scores are N(1500,300) and if sophire scored at 76th percentile, what was her actual score?
76th percentile has an associated z score to it so find that in the table. thats at z= 0.71. then using the z score equation you can solve for observed as, $$oberserved=(300)(0.71)+1500=1713.$$
$$\textbf{Example}$$
Let’s assume SAT scores are   N(1500, 300). Between what two scores do the middle 50 In the probability curve we have the middle 50$$\%$$ that we want to cover. which means there is $$\frac{.50}{2}$$ left on each side of the curve. which means we need to no find the scores the way we did above but at .25 percentile and the .75 percentile.

## The Binomial Model

The binomial probability distribution is a discrete probability distribution function
Useful in many situations where you have numerical variables that are counts or whole numbers
Classic application of the binomial model is counting heads when flipping a coin
The binomial model provides probabilities for random experiments in which you are counting the number of successes that occur. Four characteristics must be present:

• 1)Fixed number of trials: n

• 2) The only two outcomes are success and failure

• 3) The probability of success, p, is the same at each trial

• 4) The trials are independent

## Computing binomial Probabilities

The formula that finds the probabilities for the binomial distribution for probability of success p, fixed number of trials n, and k successes is as follows: ${n \choose k}p^k(1-p)^{n-k}$ where ${n \choose k}=\frac{n!}{k!(n-k)!}$
$$\textbf{example}$$
A Stats 10 test has 4 multiple choice questions with four choices with one correct answer each. If we just randomly guess on each of the 4 questions, what is the probability that you get exactly 2 questions correct?
0.2109
If you calculating binomial probabilities and the ask for an at least question its p=1-P(0), where P is binomial probability.

## Expected Value and Standard Deviation for binomials

The expected value or mean=np
standard deviation=$$\sqrt{np(1-p)}$$
The shape of the binomial distribution depends on both n and p.
Binomial distributions are symmetric when p = 0.5, but they are also symmetric when n is large, even if p is close to 0 or 1.
When np$$\geq 10$$ and when n(1-p)$$\geq 10$$ then we can approximate a binomial as a normal distribution with the same definitions of mean and standard deviation of the binomial.
After checking if you question meets the require