krista at aha.demon.nl
Tue Aug 17 21:12:55 CEST 2004
As I am quitte an ignorant user of R, excuse me for any wrongfull usage of
all the terms.
My question relates to the statistics behind the survdiff function in the
My textbook knowledge of the logrank test tells me that if I want to compare
two survival curves, I have to take the sum of the factors: (O-E)^2/E of
both groups, which will give me the Chisq.
If I calculate this by hand, I get a different value than the one R is
Actually, the (O-E)^2/E that R gives me, those I agree with, but if I then
take the sum, this is not the chisq R gives.
- How is Chisq calculated in R?
- What does the column (O-E)^2/V mean? What is V, and how does this possibly
relate to the calculated Chisq?
The syntax would be something like this:
mydatafile <- data.frame(mydatafile)
And the response would be:
survdiff(formula = Surv(surv, event) ~ gr, data = mydatafile)
N Observed Expected (O-E)^2/E (O-E)^2/V
gr=1 5 5 2.02 4.41 7.91
gr=2 4 2 4.98 1.79 7.91
Chisq= 7.9 on 1 degrees of freedom, p= 0.00491
But, as said, I, with my textbook knowledge, I would calculate Chisq as:
Hopefully someone can clarify this for me.
More information about the R-help