Unlike [wikipedia](https://en.wikipedia.org/wiki/Proportional_hazards_model), the linear predictor (LP) in `coxph` is made dependent from the baseline hazard function $\lambda$. For example, if a model has two predictors `x1`, `x2` stratified by `sex`, the linear predictor would be like: $$LP = log ( \lambda _{sex}) + \beta _{1}x _{1}+\beta _{2}x _{2}$$ Where the $log(\lambda _{sex})$ can be obtained by `predict()` with `x1=x2=0`. We could calculate the LP without strata information (sex) by hand using the $\beta _{1} \, \beta _{2}$ provided by `coef(fit)` and a customised $\lambda _{unkown \, sex}$. Below is a simulation comparing the results from `predict()` and by hand `coef(fit)`. ``` ## Toy data df <- list(time=c(4,3,1,1,2,2,3), status=c(1,1,1,0,1,1,0), x1=c(0,2,1,1,1,0,0), x2=1:7, sex=c(0,0,0,0,1,1,1)) ## Fit a stratified model fit <- coxph(Surv(time, status) ~ x1 + x2 + strata(sex), df) coef(fit) # x1 x2 # 0.79451881 -0.01917633 ## Baseline linear predictor lambda_sex1 <- predict(fit, newdata=list(x1=0, x2=0, sex=0)) # -0.746578 lambda_sex2 <- predict(fit, newdata=list(x1=0, x2=0, sex=1)) # -0.1497816 ## by predict function predict(fit, newdata=list(x1=1, x2=2, sex=0)) # 0.009588167 predict(fit, newdata=list(x1=1, x2=2, sex=1)) # 0.6063845 ## by hand lambda_sex1 + coef(fit)[1]*1 + coef(fit)[2]*2 # 0.009588167 lambda_sex2 + coef(fit)[1]*1 + coef(fit)[2]*2 # 0.6063845 ``` Finally, to calculate "a" linear predictor for an unknown `sex`: ``` # prevented by predict function predict(fit, newdata=list(x1=1, x2=2, sex=2)) #Error in model.frame.default(data = list(x1 = 1, x2 = 2, sex = 2), formula = ~x1 + : # factor strata(sex) has new level sex=2 # by hand, assuming lambda for sex 2 is 0 0 + coef(fit)[1]*1 + coef(fit)[2]*2 # 0.7561661 ```