Where is the linear predictors (eta) located in the statsmodels.GLM class?
If a fitted model mdl = sm.GLM(Y, X, family = family()).fit()
is equal to R's mdl <- glm.fit(X, Y, family = family())
, then R's eta can be found mdl$linear.predictors
. But i can't seem to find eta in statsmodels.
Right now i calculate them by X @ mdl.params
, which seems a bit tedious
eta
is not a very descriptive name. The internal name in statsmodels is linpred
.
The linear predictor including offset and exposure can be obtained using the results predict method
results_glm.predict(..., linear=True)
or md1.predict
in your case.
Offset can be set to zero using the keyword to obtain the linear predictor without offset, similar for exposure.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.