# How to Define the functional form for Cox Regression using PHREG SAS

I would like to include two covariates that are Snow and Salt for deterioration modeling of bridges. I generated the Cumulative Martingale residual for the two and the shapes are attached. I Tried several other functions such as log, square root, power two and three, but it looks that none worked so far. I would be grateful if anyone could give me a hint on how to proceed with this. [. .

The histogram of the data looks like a bell curve as shown below. The vertical access in the histograms is a percentage and there are about 4000 bridges in the data set. about 90% of the bridges are failed - not in a physical way but some defined performance criteria. The loess fit for snow and salt is shown below.

• From the histograms, it looks like there are only about 100 observations. How many bridges failed? If you have a lot of data and a lot of failures, you can use loess instead of a fixed transformation to let the data decide the best. If you have a small amount of data, it is better to stick with simple models. If there is no good physics base reason for a particular transformation, I would keep the original variables. Use AIC to choose between a handful of models. – John L Mar 18 at 18:40
• As suggested by @JohnL it would help if you could specify how many events (failures) there are, as that indicates how flexibly you can model your predictors. Also, what is the correlation between Snow and Salt per mile? I suspect that it's fairly high, which could pose collinearity problems for a standard Cox regression model. Please provide this information by editing the original question, as comments are easy to overlook and can sometimes be lost. – EdM Mar 18 at 21:15
• @JohnL please have a look at my edited post. Thanks, – mmhxc5 Mar 19 at 16:11
• @EdM, thank you for your help. Please have a look at my edited post. – mmhxc5 Mar 19 at 16:11
• OK, I see. 4000 bridges with 90 failures is a pretty large dataset. I would try loess and if it seems like a simpler function will be approximately the same fit, then use the simpler model. I don't know how to do that in SAS phreg. – John L Mar 19 at 16:17

I don't know how to do this in SAS, but modeling continuous predictors as restricted cubic splines is implemented simply in the rcs() function of the R rms package. See Section 2.4.5 of Harrell's course notes. You could specify 4 knots for each of Snow and Salt, providing visually smooth functional forms within the outer knots and linear extrapolation outside them, chosen directly to fit the data.