若干年前学过R语言的选修课, 现在忘了个一干二净
> c <- rnorm(100,5)
> t.test(c,mu=100)
One Sample t-test
data: c
t = -1095.3, df = 99, p-value < 2.2e-16
alternative hypothesis: true mean is not equal to 100
95 percent confidence interval:
4.789196 5.133539
sample estimates:
mean of x
4.961367
> t.test(c,mu=5)
One Sample t-test
data: c
t = -0.44523, df = 99, p-value = 0.6571
alternative hypothesis: true mean is not equal to 5
95 percent confidence interval:
4.789196 5.133539
sample estimates:
mean of x
4.961367
首先是创建了一个正态分布的向量c,100个元素,均值为5.
下面检验一下c这个向量是不是来自均值为mu的正态分布
(mu=100的时候当然不符合了,结果也显示p很小)
(mu=5的时候,p是0.6几,不能拒绝替代假设)
哦好的,书上说mu是形参,我几乎已经忘了这个词(形参实参这种词就是用来迷惑人的,谁发明了这俩词,真够有毛病的)
> d<- a^2
> plot(a,d)
d=a^2