[R] survdiff for Left-truncated and right-censored data

2005-11-23 Thread Sing-Yee Ling
dear all,

I would like to know whether survdiff and survReg function in the 
survival package work for left-truncated and right-censored data.

If not, what other functions can i use to make comparison between two 
survival curves with LTRC data.

thanks for any help given

sing yee

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] survdiff for Left-truncated and right-censored data

2005-11-23 Thread Thomas Lumley
On Wed, 23 Nov 2005, Sing-Yee Ling wrote:

 dear all,

 I would like to know whether survdiff and survReg function in the
 survival package work for left-truncated and right-censored data.

The survdiff and survfit functions do, as does coxph.  There is no survReg 
in the survival package, but there is survreg, and it does not handle left 
truncation.

-thomas

 If not, what other functions can i use to make comparison between two
 survival curves with LTRC data.

 thanks for any help given

 sing yee

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Thomas Lumley   Assoc. Professor, Biostatistics
[EMAIL PROTECTED]   University of Washington, Seattle

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] survdiff

2004-08-18 Thread Thomas Lumley
On Tue, 17 Aug 2004, Peter Dalgaard wrote:


 You really need to read a theory book for this, but here's the basic idea:

 V is the theoretical variance of O-E for the first group. If O-E is
 approximately normally distributed, as it will be in large samples,
 then (O-E)^2/V will be approximately chi-squared distributed on 1 DF.

 In *other* models, notably those for contingency tables, the same idea
 works out as the familiar sum((O-E)^2/E) formula. That formula has
 historically been used for the logrank test too, and it still appears
 in some textbooks, but as it turns out, it is not actually correct
 (although often quite close).


You don't necessarily need a theory book --- sufficiently old biostat
textbooks may have this. For example, Fisher  van Belle (1993)
Biostatistics: a methodology for the health sciences gives both formulas
and explains that the simpler one is a useful approximation for hand
calculation, with a worked example.

Now that we have computers no-one needs to use the approximation, and most
of that information has been taken out of the second edition.

-thomas

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] survdiff

2004-08-17 Thread Peter Dalgaard
Krista Haanstra [EMAIL PROTECTED] writes:

 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
 package survival.
 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
 giving me.
 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.
 Two questions:
 - 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?

You really need to read a theory book for this, but here's the basic idea:

V is the theoretical variance of O-E for the first group. If O-E is
approximately normally distributed, as it will be in large samples,
then (O-E)^2/V will be approximately chi-squared distributed on 1 DF.

In *other* models, notably those for contingency tables, the same idea
works out as the familiar sum((O-E)^2/E) formula. That formula has
historically been used for the logrank test too, and it still appears
in some textbooks, but as it turns out, it is not actually correct
(although often quite close).

[To fix ideas, consider testing for a given p in the binomial
distribution, you can either say O=x E=np V=npq and get

chisq = (x-np)^2/npq 

or have O = (x, n-x), E = (np, nq) and get

chisq =  (x-np)^2/np + ((n-x) - nq)^2/nq

and a little calculus show that the latter expression is

 = (x-np)^2*(1/np + 1/nq) = (x-np)^2 * (p+q)/npq

so the two formulas are one and the same. In this case!]
-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html