Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Proc Phreg for time varying exposure variable- different output

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

☑ This topic is **solved**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 10-17-2023 10:40 PM
(311 views)

Hi,

My data set looks like:

ID | event | Met_01 | Start (days) | Stop (days) | Fu_time (stop-start) |

1 | 0 | 0 | 0 | 230 | 230 |

1 | 1 | 1 | 230 | 1430 | 1200 |

2 | 1 | 0 | 0 | 907 | 907 |

3 | 0 | 0 | 0 | 365 | 365 |

3 | 1 | 1 | 365 | 790 | 425 |

When I am applying time varying Cox regression in SAS using following 2 codes then I am getting completely different Hazard Ratio (model 1: crude HR 0.95 and model 2:crude HR 0.74).

Model 1:

proc phreg data=test;

class met_01/ref=first;

model (**start, stop**) * event (0) = met_01/ties=EFRON RL;

run;

Model 2:

proc phreg data=test;

class met_01/ref=first;

model **fu_time*** event (0) = met_01/ties=EFRON RL;

run;

I am not sure which one is to consider. Any help on this will be highly appreciated. I am struggling on this point from a long time.

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Both can be correct, but most likely you should use (start, stop).

It has to do with how you define the baseline hazard. If the baseline hazard should be a function of time since 0 then use (start, stop).

If the hazard functions should be reset, such it is a functio of time since last stop time then you can use your model 2.

In far most cases, model 1 is the right way to go.

For your second question about how the hazard ratio is calculated, the simple answer is that it is the maximum point of the Cox's partial likelihood function. The hazard ratio has no closed analytical form. Except in simple cases with very few events. In your case the estimated hazard ratio is the maximum point of the function (x/(1+2*x))*(1/(1+x)) which is sqrt(1/2). I dont get exactly same number as you mention btw, but I have tried run the SAS code and the solution is indeed sqrt(0.5)=0.707.

4 REPLIES 4

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Both can be correct, but most likely you should use (start, stop).

It has to do with how you define the baseline hazard. If the baseline hazard should be a function of time since 0 then use (start, stop).

If the hazard functions should be reset, such it is a functio of time since last stop time then you can use your model 2.

In far most cases, model 1 is the right way to go.

For your second question about how the hazard ratio is calculated, the simple answer is that it is the maximum point of the Cox's partial likelihood function. The hazard ratio has no closed analytical form. Except in simple cases with very few events. In your case the estimated hazard ratio is the maximum point of the function (x/(1+2*x))*(1/(1+x)) which is sqrt(1/2). I dont get exactly same number as you mention btw, but I have tried run the SAS code and the solution is indeed sqrt(0.5)=0.707.

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

**If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. **

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.