One Tailed and Two Tailed Tests

本文对比了单尾和双尾检验的差异,强调了在不同情况下选择哪种检验取决于问题的性质。以软饮料公司为例,顾客怀疑瓶装可乐少于600ml,形成的是单尾检验的假设;而质量控制团队希望确保瓶装可乐精确为600ml,因此采用双尾检验。此外,文章通过一个案例展示了如何进行双尾检验的假设测试,以确定样本平均值与600ml的显著差异。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  1. One tailed test
    1. Greater than type

H_a:\mu>\mu_0

  1. Less than type

H_a:\mu<\mu_0

  1. Two talied test

Not equal type:

H_a:\mu\neq\mu_0

Difference between One-Tailed and Two-tailed Tests

Test statistic value does not change for two-tailed or one-tailed test.

Only the critical values/p-value associated with the test statistic changes

 

Example : one tailed and two-tailed

Suppose a soft-drink manufacturer's most selling product is 600ml co

To perform these tests in R, we first need to read in the data from the file "d-amzn3dx.txt". We can do this using the following code: ```R data <- read.table("d-amzn3dx.txt", header=TRUE) ``` This assumes that the file is located in the current working directory. We can then extract the daily log returns of Amazon stock using the following code: ```R returns <- diff(log(data$amzn)) ``` This computes the difference between the logarithms of adjacent prices, which gives us the daily log returns. We can then perform the tests as follows: (a) To test the null hypothesis that the skewness measure of the returns is zero, we can use the `skewness` function from the `moments` package. This function computes the sample skewness of a given data set. We can then use a one-sample t-test to test whether the sample skewness is significantly different from zero. The code to do this is: ```R library(moments) skew <- skewness(returns) t.test(returns, mu=0, alternative="two.sided", conf.level=0.95) ``` The `skewness` function computes the sample skewness of `returns`, which is stored in the variable `skew`. The `t.test` function performs a one-sample t-test on `returns`, assuming that the true mean is zero. The `alternative="two.sided"` option specifies a two-tailed test, and `conf.level=0.95` specifies a 95% confidence level. The output of this code will include the sample skewness, the t-test statistic and p-value, and a confidence interval for the true mean. (b) To test the null hypothesis that the excess kurtosis of the returns is zero, we can use the `kurtosis` function from the `moments` package. This function computes the sample excess kurtosis of a given data set. We can then use a one-sample t-test to test whether the sample excess kurtosis is significantly different from zero. The code to do this is: ```R kurt <- kurtosis(returns) t.test(returns, mu=0, alternative="two.sided", conf.level=0.95) ``` The `kurtosis` function computes the sample excess kurtosis of `returns`, which is stored in the variable `kurt`. The `t.test` function performs a one-sample t-test on `returns`, assuming that the true mean is zero. The `alternative="two.sided"` option specifies a two-tailed test, and `conf.level=0.95` specifies a 95% confidence level. The output of this code will include the sample excess kurtosis, the t-test statistic and p-value, and a confidence interval for the true mean.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值