DATA2002 - WEEK4

t - test background:

1. sample from normal populations 

normal sample的sample mean也是正态分布,var 是chi-square distribution,这两个variable statistically independent

2. 

 

 3. if the population mean is  \mu var is S^{2} and sample mean is \overline{X}

\frac{estimator - true\_value}{standard\_ error}  ~  t_d

One sample test

已知population的sample mean, test sample mean与其是否有明显差异

workflow

我们通常选\alpha为0.05

 R:t.test(x , mu =  population mean  , alternative = c("two.sided", "less", "greater") )

Two sample test

检验两个sample的sample mean是否相同

workflow: 

 R:t.test(x , y , mu =  population mean  , alternative = c("two.sided", "less", "greater"),, var.equal = TRUE )

If we do not assume equal variance, var.equal = FALSE which is a Welch t-test. But this is not a propor t-statistic because of independent of the numerator.

Paired sample t-test

测试两个一一对应的样本平均值的差距

workflow:

 Confidence interval

\alpha is false alarm rate

c = qt(1- \alpha)/2, degree of freedom)

t.test(x, mu = population mean, conf.level = 0.99)

we reject H0 if \mu _0 outside the bounds

One-sided confidence intervals

用R的时候改一下alternative

The observed \alpha signficance level (or p-value) is the value of for which the observed data is "right on the edge". The non-coverage probability (i.e. 1 - confidence interval) for which is on the boundary of the confidence interval. R example: t.test(x, mu = 375, alt = "less" , conf.level = 1-0.1589)

Rejection regions

Critical value decision rule

 

 Rejection region for test statistics

 

Rejection region for sample mean & sample scale

 \overline{x} 和 d 拿第一个图推导即可

 power increase as n increase, false alarm rate越小,the number of se to reject H0越少

 R大法 pwr package

pwr.t.test() t-tests (one sample, 2 sample, paired)

pwr.t.test(n = NULL, d = NULL, sig.level = 0.05, power = NULL, type = c("two.sample"
,"one.sample","paired"),alternative = c("two.sided","less","greater"))

 pwr.t2n.test() t-test (two samples with unequal n)

pwr.t2n.test(n1 = NULL, n2= NULL, d = NULL, sig.level = 0.05, power = NULL, 
alternative = c("two.sided","less","greater"))

这里d是Cohen‘s d = |\mu - \mu_0|/\sigma

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值