OpenSourceEconomics/respy

kw_97_base fails to build cirterion function

peisenha opened this issue · 1 comments

  • respy version used, if any: k2000
  • Python version, if any:
  • Operating System:

Describe the bug

We cannot bulid a cirterion function without throwing an error.

To reproduce


for model in ["kw_97_basic"]:

    params, options, df = rp.get_example_model(model, with_data=True)

    simulate = rp.get_simulate_func(params, options)
    simulate(params)

    crit_func = rp.get_crit_func(params, options, df)
    crit_func(params)

results in

Traceback (most recent call last):
  File "run.py", line 21, in <module>
    crit_func = rp.get_crit_func(params, options, df)
  File "/home/peisenha/external_storage/ownCloud/office/OpenSourceEconomics/respy/respy/likelihood.py", line 72, in get_crit_func
    ) = _process_estimation_data(df, state_space, optim_paras, options)
  File "/home/peisenha/external_storage/ownCloud/office/OpenSourceEconomics/respy/respy/likelihood.py", line 504, in _process_estimation_data
    for period in range(n_periods):
TypeError: 'numpy.float64' object cannot be interpreted as an integer

Good catch! There were two issues where the dtypes in the KW97 data were a little bit special and automatic type casting yielded completely different dtypes. Resolved in #283.