# [R] Second-order effect in Parametric Survival Analysis

David Winsemius dwinsemius at comcast.net
Sun Nov 13 00:31:01 CET 2011

```On Nov 12, 2011, at 7:37 AM, ryusuke wrote:

> Hi experts,
>
> http://r.789695.n4.nabble.com/file/n4034318/Parametric_survival_analysis_2nd-order_efffect.JPG
> Parametric_survival_analysis_2nd-order_efffect.JPG
> As we know a normal survival regression is the equation (1)
> Well, I'ld like to modify it to be 2nd-order interaction model as
> shown in
> equation(2)
>
> Question:
> Assume a and z is two covariates.
> x = dummy variable (1 or 0)
> z = factors (peoples' name)
> fit <- survreg(Surv(time,censor)~x*z, data=sample, dist="exponential")
>
> I tried to apply survreg(), while I have few questions:
> 1) If */survreg(Surv(time,censor)~x*z, data=sample,
> dist="exponential")/*
> correct?

The formula interface for R would expand x*z to x + z + x:z (Which is
questions is probably what you want anyway.)

> 2) If the baseline hazard is the value excluded both x and z effects?

Maybe. You won't be  "excluding" them so much as holding their values
jointly at zero, which may or may not be the same thing.

> 3) How can I get the value and plot the hazard with only x effect (but
> exclude effect z)

You will never be able to do so. If you have an interacting variable
in a model, there will always be an effect of that covariate on
predictions associated with any covariate with which it is
interacting. You should be able to display or plot the ""x-
effects" (note the plural) that are estimated for chosen levels of z,
however. To accomplish that you should construct an appropriate
data.frame and offer it as the newdata argument to predict(fit) ....
just as you would do with any properly constructed R/S regression
package.

There is a worked example on this posting from the Master:

http://finzi.psych.upenn.edu/Rhelp10/2010-May/240458.html

--
David Winsemius, MD
West Hartford, CT

```