_覓 | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁 |
FrontPage › 觜蟆
|
|
[edit]
3 modified wald method 襦 襤郁規螳 蟲蠍 #
[edit]
4 1-sample 觜 蟆 #A蟲れ 100覈 . 伎 るジ ′企 86覈企. 蟲 94%螳 るジ ′企. 蟲螻 A蟲れ れ るジ ′ 觜 螳?
> prop.test(86,100,p=0.94) 1-sample proportions test with continuity correction data: 86 out of 100, null probability 0.94 X-squared = 9.9734, df = 1, p-value = 0.001588 alternative hypothesis: true p is not equal to 0.94 95 percent confidence interval: 0.7728837 0.9185961 sample estimates: p 0.86
z.test <- function(x,n,p=NULL,conf.level=0.95,alternative="less") { ts.z <- NULL cint <- NULL p.val <- NULL phat <- x/n qhat <- 1 - phat # If you have p0 from the population or H0, use it. # Otherwise, use phat and qhat to find SE.phat: if(length(p) > 0) { q <- 1-p SE.phat <- sqrt((p*q)/n) ts.z <- (phat - p)/SE.phat p.val <- pnorm(ts.z) if(alternative=="two.sided") { p.val <- p.val * 2 } if(alternative=="greater") { p.val <- 1 - p.val } } else { # If all you have is your sample, use phat to find # SE.phat, and don't run the hypothesis test: SE.phat <- sqrt((phat*qhat)/n) } cint <- phat + c( -1*((qnorm(((1 - conf.level)/2) + conf.level))*SE.phat), ((qnorm(((1 - conf.level)/2) + conf.level))*SE.phat) ) return(list(estimate=phat,ts.z=ts.z,p.val=p.val,cint=cint)) } z.test(86,100,p=0.94) > z.test(86,100,p=0.94) $estimate [1] 0.86 $ts.z [1] -3.368608 $p.val [1] 0.0003777444 $cint [1] 0.8134534 0.9065466 [edit]
5 n螳 讌 觜 蟆 #A 300覈 譴 100覈, B 400覈 譴 170覈 D覲企ゼ 讌讌り 譟一. A B D覿 讌讌 觜 螳り 螳?
覿 <- c(100, 170) 覿覈 <- c(300, 400) prop.test(覿, 覿覈) > prop.test(覿, 覿覈) 2-sample test for equality of proportions with continuity correction data: 覿 out of 覿覈 X-squared = 5.6988, df = 1, p-value = 0.01698 alternative hypothesis: two.sided 95 percent confidence interval: -0.16664176 -0.01669158 sample estimates: prop 1 prop 2 0.3333333 0.4250000 蟆郁骸伎
[edit]
6 覦(Exact Poisson tests) #豺伎危 一危一 ..
> poisson.test(覿, 覿覈) Comparison of Poisson rates data: 覿 time base: 覿覈 count1 = 100, expected count1 = 115.71, p-value = 0.05656 alternative hypothesis: true rate ratio is not equal to 1 95 percent confidence interval: 0.6064139 1.0099403 sample estimates: rate ratio 0.7843137 1覲
> poisson.test(83, 100) Exact Poisson test data: 83 time base: 100 number of events = 83, time base = 100, p-value = 0.09854 alternative hypothesis: true event rate is not equal to 1 95 percent confidence interval: 0.6610904 1.0289099 sample estimates: event rate 0.83
鏤
|
磯Μ 殊 . る 朱 朱 訖企. ( ) |