# [R] Probability of sample proportion given true proportion

#### dmorris87

##### New Member
Hi everyone,

First post here. I am looking for feedback on the results of my analysis of a sample proportion. My aim is to determine the probability of observing a sample proportion given a true proportion. In my example, my true proportion is 0.85 and my sample proportion is 0.82. My sample size is 800. I am using the z score to compute P(sample rate <= 0.82).

Code:
true_rate <- 0.85
sample_rate <- 0.82
sample_size <- 800

z_score <- (sample_rate - true_rate) / sqrt((true_rate * (1 - true_rate)) / 800)

pnorm(z_score)

# [1] [1] 0.008742337
From these results, I would conclude that the probability of observing a sample proportion that is less than or equal to 0.82 given the true proportion of 0.85 is approximately 0.009. Is my interpretation accurate?

Assuming I have correctly obtained P(sample rate <= 0.82), what is the wisest approach to obtaining P(sample rate <= 0.82) OR P(sample rate >= 0.88)? Since I am assuming a normal distribution, is it simply a matter of multiplying P(sample rate <= 0.82) by 2?

Code:
pnorm(z_score)*2
# [1] 0.01748467

#### Archidamus

##### Member
Your code looks good and yes your P(sample<=0.82) is good. Because you are sampling 800 items, you can assume the sampling distribution is normal, and thus symmetric. Therefor yes multiply by 2 to get P(0.82<= sample rate <= 0.88)