For example, I'm doing some survival analysis and want to fit a model:
fit1 <- coxph(formula = Surv(week, arrest)~., data = rossi)
I know that the "~." is a shorthand way to include all covariates in the fit. However, there are instances like
fit1 <- coxph(formula = Surv(week, arrest)~1, data = rossi)
where "~1" is used instead, though I'm not really sure what the 1 does. What's the difference between these two things, if any?