jgellar / pcox

Penalized Cox regression models
1 stars 0 forks source link

Add offsets, other special terms #41

Open jgellar opened 7 years ago

jgellar commented 7 years ago

Phil is working on a project right now using pcox, and he wants to fit a model w/ offsets. coxph() can include offset() terms in the model formula, but right now the way we have it, in pcox we reconstruct the formula from scratch, adding all the terms that we search for. Since we don't search for offsets, it won't ever find it.

I can think of two ways to implement this for pcox:

  1. We add "offset" as a special term that we search for, and if we find it we add it to the coxph formula. The downside is that the user wouldn't be able to include terms that we don't search for, but that coxph allows.
  2. Instead of creating a formula from scratch, when we process each term that is in the pcox formula, we replace it with the new term that is going to be sent to coxph. That way anything that is not processed is just left alone and passed to coxph.

Do you see any downside of the second approach? Other than it will take longer to implement because it would require more changes, and I don't have the time right now...