I'm coming enlightenment. Im sure this question is something very simple that Im missing. I would like to add in a report the linear predictor formula from a gee model. There is a Hmisc::Formula that extract the formula but it does not work for geeglm objects. Additionally, the model has a spline term and after a while looking around on how to extract the formula I was not able to do so.
fitar1_11 <- geeglm(outcome ~ v1 + v2 + v4_recoded + v5_trunc + bs(weeks, df = 3), family = binomial(), data = M2, id = f1p0, corstr = "ar1")
geeglm(formula = outcome ~ v1 + v2 + v4_recoded + v5_trunc +
bs(weeks, df = 3), family = binomial(), data = M2, id = f1p0,
corstr = "ar1")
v2 v4_recodedNET, NGT, JF, OET, GF or TPN
v5_trunc bs(weeks, df = 3)1
bs(weeks, df = 3)2 bs(weeks, df = 3)3
Degrees of Freedom: 472 Total (i.e. Null); 464 Residual
> nd # newdata to predict at
v1 v2 v4_recoded v5_trunc weeks
1 8 3 No catheter 36 2
> predict(fitar1_11, type = "response", newdata = nd) # prediction from the model
# Not working prediction from the handmade formula
> plogis(-1.586386 + 0.08363458*nd$v1 + -0.03763166*nd$v2 + 4503599142291968*0 + 0.07261799*nd$v5_trunc + 0.003469451*nd$weeks + 0.3756985*pmax(nd$weeks-1,0)^3 + 4.542696*pmax(nd$weeks-8,0)^3)
What am I missing to make this formula to make correct predictions? Any further reading would also be nice.