Skip to content

ENH/BUG: get_prediction for more models and cases - #7900

Merged
josef-pkt merged 4 commits into
statsmodels:mainfrom
josef-pkt:get_prediction_beta
Nov 25, 2021
Merged

josef-pkt merged 4 commits into
statsmodels:mainfrom
josef-pkt:get_prediction_beta

Conversation

@josef-pkt

@josef-pkt josef-pkt commented Nov 23, 2021 •

Copy link
Copy Markdown
Member

another round for get_predictions

  • get_prediction which="linear" didn't work if there are extra_params
  • add GenericLikelihoodModelResults.get_prediction
  • minimal unit tests for BetaModel get_prediction inherited from GenericLikelihood, no verified se, conf_int
  • ...

decision for now:

  • get_prediction_linear is only used for first exog in multilink models
  • all other linear predictions go through NonlinearDeltaCov. Results will be the same except for numerical derivative
  • zero-inflated models have inflation params before main paramss, i.e. params for exog are not first segment of params.
    I don't support (for now) using get_prediction_linear for ZI models.
  • ...

@josef-pkt

Copy link
Copy Markdown
Member Author

still to do: add agg_weights

  • only use if average=True, i.e. in NonlinearDeltaCov.
  • no normalization by agg_weights.sum() (similar to freq_weights), for subset use agg_weights / agg_weights.mean() = agg_weights / agg_weights.sum() * nobs
  • different name from freq_weights so we don't have name collision.

GLM.get_prediction is now behind generic get_prediction, no NonlinearDeltaCov average=True option
I think we need a deprecation cycle for _mean postfix.
Maybe delegate to new generic get_prediction if average=True
I could use which as a trigger for new generic. which="linear" would only return linear prediction not full prediction as now.

@josef-pkt

Copy link
Copy Markdown
Member Author

last commit has backwards incompatible renaming of methods in BetaModel, privatizing predict_var and predict_precision.
BetaModel has only been added in 0.13

still to do (maybe later)

  • check row labels for pandas, I haven't checked that at all yet.
  • maybe extend NonlinearDeltaCov to 2-dim return of func, currently which="prob" only works with average=True
  • unit tests: more case to verify the generic code. We don't find comparable results in other packages for all specific models and cases.

@josef-pkt

Copy link
Copy Markdown
Member Author

merging this.
next I will try score_test for BetaModel with backwards incompatible changes in return type in score_factor

@josef-pkt
josef-pkt merged commit 81e6181 into statsmodels:main Nov 25, 2021
@josef-pkt josef-pkt mentioned this pull request Nov 25, 2021
1 task done
@josef-pkt josef-pkt mentioned this pull request Oct 6, 2022
16 of 20 tasks
@josef-pkt
josef-pkt deleted the get_prediction_beta branch October 19, 2022 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant