Skip to content

Some documentation / example code in the jupyter is not compatible with statsmodels==0.14.0 #3

@MaNyh

Description

@MaNyh

description

when trying out this repository, i installed it in a explorative and "complex" conda environment. I tried running the jupyter content and the Readme.md content, but i ran into problems with the following lines


estimates_from_bootstrap = []
ar_estimates_from_bootstrap = np.zeros((B, ))

for b in range(B):
    y_bootstrap = y_star_cb[b, :]
    ar_bootstrap = AR(y_bootstrap)
    estimate_from_bootstrap = ar_bootstrap.fit(maxlag=1)
    estimates_from_bootstrap.append(estimate_from_bootstrap)
    ar_estimates_from_bootstrap[b] = estimate_from_bootstrap.params[1]
for b in range(B):
    y_bootstrap = y_star_cb[b, :]
    ar_bootstrap = AR(y_bootstrap)
    estimate_from_bootstrap = ar_bootstrap.fit(maxlag=1)
    estimates_from_bootstrap.append(estimate_from_bootstrap)
    ar_estimates_from_bootstrap[b] = estimate_from_bootstrap.params[1]
    
Traceback (most recent call last):
  File "/home/many/miniconda3/envs/NTRfC/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3508, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-7-4185b4e22b07>", line 3, in <module>
    ar_bootstrap = AR(y_bootstrap)
TypeError: AutoReg.__init__() missing 1 required positional argument: 'lags'

and with the argument "lags=1" i get another error in the next line

for b in range(B):
    y_bootstrap = y_star_cb[b, :]
    ar_bootstrap = AR(y_bootstrap, lags=1)
    estimate_from_bootstrap = ar_bootstrap.fit(maxlag=1)
    estimates_from_bootstrap.append(estimate_from_bootstrap)
    ar_estimates_from_bootstrap[b] = estimate_from_bootstrap.params[1]
    
Traceback (most recent call last):
  File "/home/many/miniconda3/envs/NTRfC/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3508, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-8-08e5369de8f2>", line 4, in <module>
    estimate_from_bootstrap = ar_bootstrap.fit(maxlag=1)
TypeError: AutoReg.fit() got an unexpected keyword argument 'maxlag'

This code is executing:

    for b in range(B):
        y_bootstrap = y_star_cb[b, :]
        ar_bootstrap = AR(y_bootstrap,lags=1)
        estimate_from_bootstrap = ar_bootstrap.fit()
        estimates_from_bootstrap.append(estimate_from_bootstrap)
        ar_estimates_from_bootstrap[b] = estimate_from_bootstrap.params[1]

environment

(NTRfC) many@strichibarbar:~/PycharmProjects/NTRfC$ conda env export
name: NTRfC
channels:
  - defaults
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - bzip2=1.0.8=h7b6447c_0
  - ca-certificates=2023.01.10=h06a4308_0
  - ld_impl_linux-64=2.38=h1181459_1
  - libffi=3.4.4=h6a678d5_0
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - libuuid=1.41.5=h5eee18b_0
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1t=h7f8727e_0
  - pip=23.0.1=py310h06a4308_0
  - python=3.10.11=h7a1cb2a_2
  - readline=8.2=h5eee18b_0
  - setuptools=67.8.0=py310h06a4308_0
  - sqlite=3.41.2=h5eee18b_0
  - tk=8.6.12=h1ccaba5_0
  - wheel=0.38.4=py310h06a4308_0
  - xz=5.4.2=h5eee18b_0
  - zlib=1.2.13=h5eee18b_0
  - pip:
    - aiohttp==3.8.4
    - aiosignal==1.3.1
    - alabaster==0.7.13
    - alphashape==1.3.1
    - anyio==3.7.0
    - argon2-cffi==21.3.0
    - argon2-cffi-bindings==21.2.0
    - arrayfire==3.8.0
    - arrow==1.2.3
    - asttokens==2.2.1
    - async-timeout==4.0.2
    - attrs==23.1.0
    - babel==2.12.1
    - backcall==0.2.0
    - beautifulsoup4==4.12.2
    - bleach==6.0.0
    - cached-property==1.5.2
    - certifi==2023.5.7
    - cffi==1.15.1
    - cfgv==3.3.1
    - charset-normalizer==3.1.0
    - click==8.1.3
    - click-log==0.4.0
    - cloudpickle==2.2.1
    - cocos==0.2.2
    - comm==0.1.3
    - contexttimer==0.3.3
    - contourpy==1.0.7
    - cycler==0.11.0
    - debugpy==1.6.7
    - decorator==5.1.1
    - defusedxml==0.7.1
    - descartes==1.1.0
    - dill==0.3.7
    - distlib==0.3.6
    - distro==1.8.0
    - docutils==0.20.1
    - exceptiongroup==1.1.1
    - executing==1.2.0
    - fastjsonschema==2.17.1
    - filelock==3.12.2
    - fluidfoam==0.2.4
    - fonttools==4.39.4
    - fqdn==1.5.1
    - frozenlist==1.3.3
    - gmsh==4.11.1
    - identify==2.5.24
    - idna==3.4
    - imageio==2.30.0
    - imagesize==1.4.1
    - iniconfig==2.0.0
    - ipykernel==6.23.1
    - ipython==8.14.0
    - ipython-genutils==0.2.0
    - ipywidgets==8.0.6
    - isoduration==20.11.0
    - jedi==0.18.2
    - jinja2==3.1.2
    - joblib==1.2.0
    - jsonpointer==2.3
    - jsonschema==4.17.3
    - jupyter==1.0.0
    - jupyter-client==8.2.0
    - jupyter-console==6.6.3
    - jupyter-core==5.3.0
    - jupyter-events==0.6.3
    - jupyter-server==2.6.0
    - jupyter-server-terminals==0.4.4
    - jupyterlab-pygments==0.2.2
    - jupyterlab-widgets==3.0.7
    - kiwisolver==1.4.4
    - lazy-loader==0.3
    - llvmlite==0.40.0
    - loky==3.4.1
    - markupsafe==2.1.3
    - matplotlib==3.7.1
    - matplotlib-inline==0.1.6
    - mistune==2.0.5
    - mpmath==1.3.0
    - multidict==6.0.4
    - multiprocess==0.70.15
    - nbclassic==1.0.0
    - nbclient==0.8.0
    - nbconvert==7.4.0
    - nbformat==5.9.0
    - nest-asyncio==1.5.6
    - networkx==3.1
    - nodeenv==1.8.0
    - notebook==6.5.4
    - notebook-shim==0.2.3
    - numba==0.57.0
    - numpy==1.24.3
    - overrides==7.3.1
    - packaging==23.1
    - pandas==2.0.2
    - pandocfilters==1.5.0
    - parso==0.8.3
    - pathos==0.3.1
    - patsy==0.5.3
    - pexpect==4.8.0
    - pickleshare==0.7.5
    - pillow==9.5.0
    - platformdirs==3.5.1
    - pluggy==1.0.0
    - pooch==1.7.0
    - pox==0.3.3
    - ppft==1.7.6.7
    - pre-commit==3.3.3
    - prometheus-client==0.17.0
    - prompt-toolkit==3.0.38
    - psutil==5.9.5
    - ptyprocess==0.7.0
    - pure-eval==0.2.2
    - pyairpar==1.1.1
    - pycparser==2.21
    - pyfoil==0.0.1
    - pygments==2.15.1
    - pyparsing==3.0.9
    - pyrsistent==0.19.3
    - pytest==7.2.2
    - python-dateutil==2.8.2
    - python-json-logger==2.0.7
    - pytz==2023.3
    - pyvista==0.39.1
    - pywavelets==1.4.1
    - pyyaml==6.0
    - pyzmq==25.1.0
    - qtconsole==5.4.3
    - qtpy==2.3.1
    - recombinator==0.0.6.1
    - requests==2.31.0
    - rfc3339-validator==0.1.4
    - rfc3986-validator==0.1.1
    - rtree==1.0.1
    - scikit-build==0.17.6
    - scikit-image==0.22.0rc0.dev0
    - scikit-learn==1.2.2
    - scipy==1.10.1
    - scooby==0.7.2
    - send2trash==1.8.2
    - shapely==2.0.1
    - simulated-annealing==0.0.1
    - six==1.16.0
    - sniffio==1.3.0
    - snowballstemmer==2.2.0
    - soupsieve==2.4.1
    - sphinx==7.0.1
    - sphinxcontrib-applehelp==1.0.4
    - sphinxcontrib-devhelp==1.0.2
    - sphinxcontrib-htmlhelp==2.0.1
    - sphinxcontrib-jsmath==1.0.1
    - sphinxcontrib-qthelp==1.0.3
    - sphinxcontrib-serializinghtml==1.1.5
    - stack-data==0.6.2
    - statsmodels==0.14.0
    - sympy==1.12
    - terminado==0.17.1
    - threadpoolctl==3.1.0
    - tifffile==2023.7.10
    - tinycss2==1.2.1
    - tomli==2.0.1
    - tornado==6.3.2
    - tqdm==4.65.0
    - traitlets==5.9.0
    - trame==2.5.0
    - trame-client==2.9.0
    - trame-components==2.1.1
    - trame-deckgl==2.0.2
    - trame-markdown==2.0.2
    - trame-matplotlib==2.0.2
    - trame-plotly==2.1.1
    - trame-rca==0.3.1
    - trame-router==2.0.2
    - trame-server==2.11.4
    - trame-simput==2.3.2
    - trame-vega==2.0.3
    - trame-vtk==2.4.4
    - trame-vuetify==2.2.4
    - trimesh==3.22.3
    - tzdata==2023.3
    - uri-template==1.2.0
    - urllib3==2.0.2
    - virtualenv==20.23.1
    - vtk==9.2.6
    - wcwidth==0.2.6
    - webcolors==1.13
    - webencodings==0.5.1
    - websocket-client==1.5.2
    - widgetsnbextension==4.0.7
    - wslink==1.11.0
    - yarl==1.9.2
prefix: /home/many/miniconda3/envs/NTRfC

proposed solution

test the repository content in pytest or unittest. i could help with pytest.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions