Please help: "AttributeError: module 'statsmodels.sandbox' has no attribute 'stats'"

262 views
Skip to first unread message

Fabio

unread,
Sep 14, 2017, 12:14:35 PM9/14/17
to pystatsmodels
This is driving me crazy. I wanted to use statsmodels.sandbox.stats.multicomp.multipletests, but I keep getting the following error:

"AttributeError: module 'statsmodels.sandbox' has no attribute 'stats'"

I've just spent the past two hours trying to get it to work. I'm currently on Windows 7, and the statsmodel package is up to date. I even tried to reinstall Anaconda but it did not help.

Am I doing something wrong? Any help would be greatly appreciated.

Thanks.

josef...@gmail.com

unread,
Sep 14, 2017, 12:29:51 PM9/14/17
to pystatsmodels
You need to show the full import statements that you used, otherwise we cannot guess what might be wrong

This works for me to import the sandbox function

In [427]:
from statsmodels.sandbox.stats.multicomp import multipletests
multipletests
Out[427]:
<function statsmodels.stats.multitest.multipletests>


However, importing this from the sandbox is not recommended.
The official path is statsmodels.stats.multitest and the sandbox module will be deprecated when it is moved. The sandbox module has additional functions that are not sufficiently finished and tested to move them yet.

Here are some ways to import or access the function or the "official" module

access through api

In [424]:
import statsmodels.api as sm
sm.stats.multipletests
Out[424]:
<function statsmodels.stats.multitest.multipletests>


access via module in statsmodels.stats

In [420]:
from statsmodels.stats.multitest import multipletests
import statsmodels.stats.multitest as multi

In [421]:
multi
Out[421]:
<module 'statsmodels.stats.multitest' from 'm:\\josef_new\\eclipse_ws\\statsmodels\\statsmodels_py34_pr\\statsmodels\\stats\\multitest.py'>

In [422]:
multipletests
Out[422]:
<function statsmodels.stats.multitest.multipletests>


Josef

Reply all
Reply to author
Forward
0 new messages