I was working on statistics using R. Before i do this using R program, i have done it manually. So here is the problem.
A sample of 300 TV viewers were asked to rate the overall quality of television shows from 0 (terrible) to 100 (the best). A histogram was constructed from the results, and it was noted that it was mound-shaped and symmetric, with a sample mean of 65 and a sample standard deviation of 8. Approximately what proportion of ratings would be above 81?
I have answered it manually with this : Pr(X>81)=Pr(Z>(81-65)/8)=Pr(Z>2)=0.0227 So the proportion is 0.023 or 2.3%
I have trouble with how can i do this in R ? I have tried using pnorm(p=..,mean=..,sd=..)
but didnt find similar result with my manual.
Thank you so much for the answer
This is given by the formula Z=(X-m)/s where Z is the z-score, X is the value you are using, m is the population mean and s is the standard deviation of the population. Consult a unit normal table to find the proportion of the area under the normal curve falling to the side of your value.
If items with the character are coded 1, and items lacking that character are coded 0, the proportion (p) of items with that character is the sum of their coded values (f) divided by the number of values coded (n).
You identified the correct function.
The help on pnorm
gives the list of arguments:
pnorm(q, mean = 0, sd = 1, lower.tail = TRUE, log.p = FALSE)
with the explanation for the arguments:
x, q: vector of quantiles.
mean: vector of means.
sd: vector of standard deviations.
log, log.p: logical; if TRUE, probabilities p are given as log(p).
lower.tail: logical; if TRUE (default), probabilities are P[X <= x]
otherwise, P[X > x].
Under "Value:" it says
... ‘pnorm’ gives the distribution function,
So that covers everything. If you put the correct value you want the area to the left of in for q
and the correct mu and sigma values, you will get the area below it. If you want the area above, add lower.tail=FALSE
.
Like so:
pnorm(81,65,8) # area to left
[1] 0.9772499
pnorm(81,65,8,lower.tail=FALSE) # area to right ... which is what you want
[1] 0.02275013
(this way is more accurate than subtracting the first thing from 1 when you get into the far upper tail)
Edit: This diagram might clarify things:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With