用正态分布计算R的比例

时间:2021-10-10 00:59:44

I was working on statistics using R. Before i do this using R program, i have done it manually. So here is the problem.

在使用R程序之前,我正在使用R进行统计,我已经手动完成了。这就是问题所在。

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?

研究人员对300名电视观众进行了抽样调查,要求他们对电视节目的整体质量进行打分,从0(糟糕)到100(最好)。根据结果构造了一个直方图,并注意到它是堆积状且对称的,样本均值为65,样本标准差为8。大约什么比例的评级会超过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%

我已经手工回答过了:Pr(X>81)=Pr(Z>(81-65)/8)=Pr(Z>2)=0.0227,所以比例为0.023或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

我不知道怎么用R表示?我试过使用pnorm(p=..,mean=.,sd=.),但是我的使用手册没有发现类似的结果。非常感谢你的回答

1 个解决方案

#1


3  

You identified the correct function.

你找到了正确的函数。

The help on pnorm gives the list of arguments:

pnorm的帮助给出了参数列表:

 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.

这涵盖了。如果你输入正确的值你想要q左边的面积和正确的mu和sigma值,你会得到它下面的面积。如果你想要上面的区域,添加low .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)

(这种方法比从1中减去第一项更准确

Edit: This diagram might clarify things:

编辑:这个图表可能会澄清一些事情:

用正态分布计算R的比例

#1


3  

You identified the correct function.

你找到了正确的函数。

The help on pnorm gives the list of arguments:

pnorm的帮助给出了参数列表:

 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.

这涵盖了。如果你输入正确的值你想要q左边的面积和正确的mu和sigma值,你会得到它下面的面积。如果你想要上面的区域,添加low .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)

(这种方法比从1中减去第一项更准确

Edit: This diagram might clarify things:

编辑:这个图表可能会澄清一些事情:

用正态分布计算R的比例