Search code examples
pythonnumpyscipystatsmodelsrpy2

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


Statsmodels seems to be the only library for python (besides rpy2) that provides an FDR-based BH adjustment for p-values, but it appears to not be included anymore:

statsmodels.sandbox.stats.multicomp.fdrcorrection0()

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

Was this module removed from 0.6.1? Besides using rpy2, is there any other widely used implementation of FDR p-value adjustment?


Solution

  • It's still there in version 0.8.0:

    import statsmodels
    print(statsmodels.__version__)  
    # 0.8.0rc1
    
    from statsmodels.sandbox.stats.multicomp import fdrcorrection0
    print(fdrcorrection0)
    # <function fdrcorrection at 0x0E5A3E88>
    

    You probably did not import the submodules stats and multipcomp.