dbinom(2, size=3, prob=1/6)[1] 0.06944444
Class 13
Possible values:
Binomial probability:
If
Expected Value (mean) is
Standard Deviation is
R
The function dbinom() is used to calculate
dbinom(k, size=n, prob=p)
For example, if
dbinom(2, size=3, prob=1/6)[1] 0.06944444
The d in dbinom stands for distribution or density.
R …The function pbinom() is used to calculate
pbinom(k, size=n, prob=p)
pbinom(k, size=n, prob=p, lower.tail = FALSE)
The p stands for probability.
pbinom examples:if
pbinom(13, size=16, prob=1/2)[1] 0.9979095
while
pbinom(13, size=16, prob=1/2, lower.tail=FALSE)[1] 0.002090454
or, equivalently:
1 - pbinom(13, size=16, prob=1/2)[1] 0.002090454
A discrete random variable takes on a finite number of values.
Number of heads in a set of coin tosses
Number of people who have had chicken pox in a random sample
A continuous random variable can take on any real value in an interval.
Height in a population
Blood pressure in a population
A general distinction to keep in mind: discrete random variables are counted, but continuous random variables are measured.
We use so-called density function or density curve.
The total area under the density curve is 1.
The probability that a variable has a value within a specified interval is the area under the curve over that interval.
When working with continuous random variables, probability is found for intervals of values rather than individual values.
The probability that a continuous r.v.
Thus,
The probability
gf_dist("norm", params=c(mean = 4, sd = 2))gf_dist("norm", params=c(mean = 4, sd = 2)) |>
gf_dist("norm", mean = 4, sd = 3, color="red")Empirical Rule for normal distribution:
approximately 68% of the values are within 1 SD of the mean
approximately 95% of the values are within 2 SDs of the mean
approximately 99.7% of the values are within 3 SDs of the mean
68-95-99.7
The distribution of test scores on the SAT and the ACT are both nearly normal.
Suppose that one student scores an 1800 on the SAT (Student A) and another student scores a 24 on the ACT (Student B). Which student performed better?
The standard normal distribution is defined as a normal distribution with mean 0 and variance 1. It is often denoted as
Any normal random variable
SAT scores are
What is the percentile rank for a student who scores an 1800 on the SAT for a year in which the scores are
Calculate a
(1800 - 1500)/300[1] 1
Find the normal probability in one of the tables, or let R do the work:
pnorm(z) calculates the area (i.e., probability) to the left of
pnorm(1)[1] 0.8413447
R do all the work …What is the percentile rank for a student who scores an 1800 on the SAT for a year in which the scores are
pnorm(1800, mean = 1500, sd = 300)[1] 0.8413447
Which score on the SAT would put a student in the 99
Identify the R: qnorm(p) calculates the value
qnorm(0.99) gives us 2.326348, or approximately 2.33.
Calculate the score,
R do the work …Which score on the SAT would put a student in the 99
qnorm(0.99, mean = 1500, sd = 300)[1] 2197.904
The q in qnorm stands for quantile.
Find the probability that
Calculate the
Now we need to find the area to the right of 1.8 under the standard normal curve.
Area to the right of 17.5.
Area to the right of 1.8.
The total area under the normal curve is always 1.
All we need to do is subtract:
area to the right = 1 - area to the left
Finally, we can find the area to the right of 1.8.
1 - pnorm(1.8)[1] 0.03593032
pnorm(1.8, lower.tail=FALSE)[1] 0.03593032