楼主: jiqimao742
1572 4

[学习分享] R Turorial-R语言与统计思想的结合!! [推广有奖]

  • 1关注
  • 4粉丝

已卖:25份资源

大专生

50%

还不是VIP/贵宾

-

威望
0
论坛币
275 个
通用积分
1.0000
学术水平
2 点
热心指数
7 点
信用等级
4 点
经验
1684 点
帖子
47
精华
0
在线时间
41 小时
注册时间
2016-9-28
最后登录
2022-2-26

楼主
jiqimao742 发表于 2016-11-6 03:05:45 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
无意中在Google搜索到一个网站,里面详细的介绍了如何用R语言来实现统计思想。 r-tutorial-thumbnail-v4-140x182.jpg


http://www.r-tutor.com/elementary-statistics/hypothesis-testing/upper-tail-test-population-mean-known-variance

例如其中一篇,详细的讲解了

Upper Tail Test of Population Mean with Known Variance即,已知方差的上单边检测。使用了两种方法。详细内容如下


Upper Tail Test of Population Mean with Known Variance

The null hypothesis of the upper tail test of the population mean can be expressed as follows:

where μ0 is a hypothesized upper bound of the true population mean μ.

Let us define the test statistic z in terms of the sample mean, the sample size and the population standard deviation σ :


Then the null hypothesis of the upper tail test is to be rejected if z ≥ zα , where zα is the 100(1− α) percentile of the standard normal distribution.


Problem

Suppose the food label on a cookie bag states that there is at most 2 grams of saturated fat in a single cookie. In a sample of 35 cookies, it is found that the mean amount of saturated fat per cookie is 2.1 grams. Assume that the population standard deviation is 0.25 grams. At .05 significance level, can we reject the claim on food label?


Solution

The null hypothesis is that μ ≤ 2. We begin with computing the test statistic.

> xbar = 2.1             # sample mean
> mu0 = 2                # hypothesized value
> sigma = 0.25           # population standard deviation
> n = 35                 # sample size
> z = (xbar−mu0)/(sigma/sqrt(n))
> z                      # test statistic
[1] 2.3664

We then compute the critical value at .05 significance level.

> alpha = .05
> z.alpha = qnorm(1−alpha)
> z.alpha                # critical value
[1] 1.6449


Answer

The test statistic 2.3664 is greater than the critical value of 1.6449. Hence, at .05 significance level, we reject the claim that there is at most 2 grams of saturated fat in a cookie.


Alternative Solution

Instead of using the critical value, we apply the pnorm function to compute the upper tail p-value of the test statistic. As it turns out to be less than the .05 significance level, we reject the null hypothesis that μ ≤ 2.

> pval = pnorm(z, lower.tail=FALSE)
> pval                   # upper tail p−value
[1] 0.0089802





二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:统计思想 R语言 significance distribution Alternative hypothesis expressed Google null 统计

沙发
newfei188 发表于 2016-11-6 05:17:21

藤椅
lonestone 在职认证  发表于 2016-11-6 07:30:23 来自手机
jiqimao742 发表于 2016-11-6 03:05
无意中在Google搜索到一个网站,里面详细的介绍了如何用R语言来实现统计思想。


谢谢你

板凳
jiqimao742 发表于 2016-11-7 04:15:17
lonestone 发表于 2016-11-6 07:30
谢谢你
不客气哈,大家互相学习,共同进步!

报纸
tianwk 发表于 2024-4-11 02:27:17
thanks for sharing

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-24 03:12