作者nono0611 (nono)
看板Statistics
标题[问题] 请问如何用R做Z-test
时间Sat Jan 10 23:21:52 2009
Create 15 random numbers that are normally distributed with mean 10 and s.d. 5. Find a 1-sample z-test at the 95% level. Did it get it right?
这是我们的作业
单就这一题
我该怎样操作R
做出Z检定
课本有给范例
看不懂意思
> simple.z.test = function(x,sigma,conf.level=0.95) {
+ n = length(x);xbar=mean(x)
+ alpha = 1 - conf.level
+ zstar = qnorm(1-alpha/2)
+ SE = sigma/sqrt(n)
+ xbar + c(-zstar*SE,zstar*SE)
+ }
## now try it
> simple.z.test(x,1.5)
[1] 173.7703 175.6297
拜托各位先贤帮助我度过期末考!
--
听说在签名档放上部落格网址可以增加当日人气.....
http://www.wretch.cc/blog/nono611
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 122.118.232.96