Skip to content
Prev 277293 / 398506 Next

Enquiry about 2nd-order interactions survival analysis

David's answers were correct.  You are looking deep into the code when
there is no reason to to so.

1. h(t|(X=x,Z=z)) = exp(Beta0 + XZBeta1) 
Most statisticians will tell you that this is an unwise model.  The
reason is that if you replace X with "X+1" the fit changes, which is
almost never desirable.  What if someone coded your dummy variable as
1/0 instead of 0/1 -- wouldn't you want to get the same fit
  Therefore the default in R for the model
     lm(y ~ x*z)
is to fit  y = b0 + b1 x + b2 z + b3 xz

   You can get exactly the model you specify as lm(y ~ x:z), or as
             temp <- x*z; lm(y ~ temp) 
Statistically, this is almost surely a mistake.

2. The model formulas work across packages.  I used lm() above, but
survreg is no different.  Formula processing is done by the
model.matrix() function, which survreg, lm, glm, ....  all call.  My C
code is all downstream of this, and irrelevant to your question.

Terry T
On Sun, 2011-11-13 at 14:39 +0800, Kenji Ryusuke wrote: