Extraction from an output
On 1/12/2009 6:42 AM, robert-mcfadden at o2.pl wrote:
Hello, Would you tell my how to extract a result from a test - it's justified because I need to run this test many times. Here is an example from authors' test:
library("coin")
lungtumor <- data.frame(dose = rep(c(0, 1, 2), c(40, 50, 48)), tumor = c(rep(c(0, 1), c(38, 2)), rep(c(0, 1), c(43, 7)), rep(c(0, 1), c(33, 15))))
ca.test<-independence_test(tumor ~ dose, data = lungtumor, teststat = "quad")
ca.test
Asymptotic General Independence Test
data: tumor by dose
chi-squared = 10.6381, df = 1, p-value = 0.001108
How to use ca.test and extract p-value and chi-squared.
pvalue(ca.test)
[1] 0.001107836
statistic(ca.test)
[1] 10.63806 See the "Value" subsection on the help page for independence_test().
Robert
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Chuck Cleland, Ph.D. NDRI, Inc. (www.ndri.org) 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, F) fax: (917) 438-0894