optimagic-dev / optimagic

optimagic is a Python package for numerical optimization. It is a unified interface to optimizers from SciPy, NlOpt and other packages. optimagic's minimize function works just like SciPy's, so you don't have to adjust your code. You simply get more optimizers for free. On top you get diagnostic tools, parallel numerical derivatives and more.
https://optimagic.readthedocs.io/
MIT License
269 stars 30 forks source link

Improve estimation table and its documentation #270

Closed janosg closed 2 years ago

janosg commented 2 years ago

Issues with current version estimation table

To-Do Code

Suggested default for number formatting

The current documentation should be almost completely replaced by the following:

Moreover we should do the following:

Discussion

hmgaudecker commented 2 years ago

here for discussion of rounding to significant digits

That link is not quite it, I think. Only looks to the right of the decimal separator, right?

One of my (and many others') pet peeves is that false sense of precision created by many tables. Like you see mean income of 38,234 Euros. Nobody cares about the 34 bit. People will start interpreting that (despite standard errors on the magnitude of hundreds), however, and miss the important parts.

Here is a function I have been using, probably got that from SO at some point, but cannot find the source.

def nsf(num, n=3):
    """n-Significant Figures"""
    numstr = ("{0:.%ie}" % (n - 1)).format(num)
    return float(numstr)
hmgaudecker commented 2 years ago

It is \sisetup{input-symbols=()}, see here https://github.com/OpenSourceEconomics/estimagic/issues/253#issuecomment-974103608

hmgaudecker commented 2 years ago

Another trivial but useful return type would be df. Should probably be the default even.

That is, return a dataframe with all the formatting of *** etc, which then takes advantage of the html rendering in a notebook. Currently, html looks ugly in notebooks.

hmgaudecker commented 2 years ago

Instead of return_type='python', maybe 'modifiable' or something like that? 'elements' ?

hmgaudecker commented 2 years ago

Thinking of it, why think of it as two functions?

  1. Format results (i.e., return the python / modifiable stuff). Potentially have different options of returning strings only or numbers (already rounded)
  2. Get the view in the output format you want

One may want to think of a short-hand again, but conceptually this might make sense?

ChristianZimpelmann commented 2 years ago

I checked out the version at the branch improve_estimation_table. A few remarks: