1) There are different ways to include categorical variables into the analysis. The most popular and default in most packages is so called
dummy coding where the first category is the "reference" category and the other are code 1 if the observation is from the category and 0 otherwise. Below is an example with R where "a" is the reference category and the columns x1b
and x1c
would enter the analysis. The coefficients for these variables would than indicate differences compared to category "a".
# create example data set
df <- data.frame(x1 = sample(letters[1:3], 6, replace = TRUE))
df
#> x1
#> 1 b
#> 2 c
#> 3 a
#> 4 b
#> 5 a
#> 6 c
# dummy coding
cbind(df, model.matrix(~x1, df)[,-1])
#> x1 x1b x1c
#> 1 b 1 0
#> 2 c 0 1
#> 3 a 0 0
#> 4 b 1 0
#> 5 a 0 0
#> 6 c 0 1
2) For the baseline hazard continuous variables have to be set to 0 as you suspect, which is why the baseline hazard often does not have a useful interpretation and not the focus of the analysis. What is done sometimes is to center the continuous variable. That way the baseline hazard corresponds to the mean value.
Created on 2019-06-08 by the reprex package (v0.3.0)
basehaz
by default a: returns the cumulative hazard function and b: centers all covariates (regardless of whether they were dummy encoded). The main response is right: if you setcentered=F
as an option tobasehaz
, then you will get the BL hazard function for the referent group. It is also related to the survival by $\exp(-\Lambda(t))$ $\endgroup$