2017-10-28 5 views
0

Rのprop.testsから要素を抽出するにはどうすればよいですか?Rのprop.testsの要素を抽出する

summary(prop.test()) ### gives this 

Length Class Mode  
statistic 1  -none- numeric 
parameter 1  -none- numeric 
p.value  1  -none- numeric 
estimate 1  -none- numeric 
null.value 1  -none- numeric 
conf.int 2  -none- numeric 
alternative 1  -none- character 
method  1  -none- character 
data.name 1  -none- character 

サンプル見積もりとCIを抽出したいと思います。

または、私にこれをもたらすパッケージがありますか?

答えて

1

あなたは直接見積もりとCIを手に入れることができます。

smokers <- c(83, 90) 
patients <- c(86, 93) 

result <- prop.test(smokers, patients) 
result 

2-sample test for equality of proportions with continuity 
    correction 

data: smokers out of patients 
X-squared = 8.3539e-30, df = 1, p-value = 1 
alternative hypothesis: two.sided 
95 percent confidence interval: 
-0.05810303 0.05285172 
sample estimates: 
    prop 1 prop 2 
0.9651163 0.9677419 

を与えるそして、あなたは

result$estimate 
result$conf.int 

はあなたに

 prop 1 prop 2 
0.9651163 0.9677419 
>  result$conf.int 
[1] -0.05810303 0.05285172 
attr(,"conf.level") 
[1] 0.95 
を与えることを持っています
関連する問題