R语言|函数|t.test()

函数介绍

t.test(x, y = NULL,

       alternative = c("two.sided", "less", "greater"),

       mu = 0, paired = FALSE, var.equal = FALSE,

       conf.level = 0.95, ...)

Value

A list with class "htest" containing the following components:

statistic

the value of the t-statistic.

parameter

the degrees of freedom for the t-statistic.

p.value

the p-value for the test.

conf.int

a confidence interval for the mean appropriate to the specified alternative hypothesis.

estimate

the estimated mean or difference in means depending on whether it was a one-sample test or a two-sample test.

null.value

the specified hypothesized value of the mean or mean difference depending on whether it was a one-sample test or a two-sample test.

alternative

a character string describing the alternative hypothesis.

method

a character string indicating what type of t-test was performed.

data.name

a character string giving the name(s) of the data.


例题:比较甲、乙两种安眠药地疗效,将20名患者分成两组,每组10人,分别服用甲、乙两种安眠药,获得相关数据表所列。一直服用两种安眠药后增加地睡眠时间服从方差相同地正态分布,且两组实验相互独立。显著性水平\alpha=0.05,试问两种安眠药地疗效有无显著差异?

表1 相关数据
类别延长睡眠时间/小时
服用甲种药1.90.81.10.10.14.45.51.64.63.4
服用乙种药0.7-1.6-0.2-1.2-0.13.43.70.80.02.0

分析:\sigma相同时,假设检验为H_{0}:\mu _{1}=\mu _{2},H_{1}:\mu _{1}\neq \mu _{2}

#函数t.test();
x<-c(1.9,0.8,1.1,0.1,0.1,4.4,5.5,1.6,4.6,3.4)
y<-c(0.7,-1.6,-0.2,-1.2,-0.1,3.4,3.7,0.8,0.0,2.0)
t.test(x,y)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  • 9
    点赞
  • 46
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值