开发者

chisq.test in R

test()` in Rand it gives me back the x-squared and the p-value.

Now I want to take the p-value and according to the reading proceed with m开发者_Go百科y program. How can I extract the p-value from the result of the output of chisq.test()?


chisq.test(x)$p.value

You can see what an object holds using str:

str(chisq.test(x))


Performing a \Chi^2 test on the vectors x and y and storing it in 'results'

results<-chisq.test(x,y)

you can then retrieve the estimated parameters as

results[1], results[3], ... or results$statistic, results$p.value, ... 

where the last part is of course the most self-describing way to do it.

Remember to cast the results to numeric values, that is

as.numeric(results[1])

HTH,

Christian

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜