Pulling Variable Names Out of Model Object

8 views
Skip to first unread message

jordan....@gmail.com

unread,
Nov 2, 2021, 10:46:11 AM11/2/21
to pystatsmodels
Hello,

I would like to make a dataframe out of the model_summary() results.  When I try to pull everything out of the results table, I can get to all of it pretty easily except the variable names.  

How can I pull the variable names out of the model_summary() results in order to match the correct metrics (params, bse, tstat, etc)?

josef...@gmail.com

unread,
Nov 2, 2021, 11:03:03 AM11/2/21
to pystatsmodels
If you want just the params_table, then you can access the individual pieces  which should already have the correct indices as pandas Series.
The conf_int is a 2 columns DataFrame, IIRC

results.params, results.bse, results.tvalues, results.pvalues, results.conf_int()

This will be numbers, while `summary` table is already formatted as strings.

There should (?) be access of the params_table as DataFrame, but I don't remember where.

Josef

--
You received this message because you are subscribed to the Google Groups "pystatsmodels" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pystatsmodel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pystatsmodels/4c1e93fe-1ee9-410c-9306-4c1bd3e40e82n%40googlegroups.com.

josef...@gmail.com

unread,
Nov 2, 2021, 11:05:03 AM11/2/21
to pystatsmodels
On Tue, Nov 2, 2021 at 11:03 AM <josef...@gmail.com> wrote:
If you want just the params_table, then you can access the individual pieces  which should already have the correct indices as pandas Series.
The conf_int is a 2 columns DataFrame, IIRC

results.params, results.bse, results.tvalues, results.pvalues, results.conf_int()

This will be numbers, while `summary` table is already formatted as strings.

There should (?) be access of the params_table as DataFrame, but I don't remember where.

The parameter names itself even if not using pandas are in `results.model.exog_names`

Jordan Howell

unread,
Nov 2, 2021, 11:20:36 AM11/2/21
to pystat...@googlegroups.com
Perfect!  Thank you. 

Jordan

On Nov 2, 2021, at 11:05 AM, josef...@gmail.com wrote:


Reply all
Reply to author
Forward
0 new messages