Ejemplo n.º 1
0
    def setup_class(cls):
        from statsmodels.datasets.stackloss import load
        cls.data = load(as_pandas=False)
        cls.data.exog = sm.add_constant(cls.data.exog, prepend=False)

        model = RLM(cls.data.endog, cls.data.exog, M=norms.HuberT())
        results = model.fit(scale_est=HuberScale())
        h2 = model.fit(cov="H2", scale_est=HuberScale()).bcov_scaled
        h3 = model.fit(cov="H3", scale_est=HuberScale()).bcov_scaled
        cls.res1 = results
        cls.res1.h2 = h2
        cls.res1.h3 = h3
Ejemplo n.º 2
0
    def setup_class(cls):
        from statsmodels.datasets.stackloss import load
        cls.data = load(as_pandas=False)  # class attributes for subclasses
        cls.data.exog = sm.add_constant(cls.data.exog, prepend=False)
        # Test precisions
        cls.decimal_standarderrors = DECIMAL_1
        cls.decimal_scale = DECIMAL_3

        model = RLM(cls.data.endog, cls.data.exog, M=norms.HuberT())
        results = model.fit(conv='sresid')
        h2 = model.fit(cov="H2").bcov_scaled
        h3 = model.fit(cov="H3").bcov_scaled
        cls.res1 = results
        cls.res1.h2 = h2
        cls.res1.h3 = h3
Ejemplo n.º 3
0
 def setup_class(cls):
     from statsmodels.datasets.stackloss import load
     cls.data = load()
     cls.data.exog = sm.add_constant(cls.data.exog, prepend=False)
     results = RLM(cls.data.endog, cls.data.exog,\
                 M=sm.robust.norms.HuberT()).fit(scale_est=\
                 sm.robust.scale.HuberScale())
     h2 = RLM(cls.data.endog, cls.data.exog,\
                 M=sm.robust.norms.HuberT()).fit(cov="H2",
                 scale_est=sm.robust.scale.HuberScale()).bcov_scaled
     h3 = RLM(cls.data.endog, cls.data.exog,\
                 M=sm.robust.norms.HuberT()).fit(cov="H3",
                 scale_est=sm.robust.scale.HuberScale()).bcov_scaled
     cls.res1 = results
     cls.res1.h2 = h2
     cls.res1.h3 = h3
Ejemplo n.º 4
0
    def setup_class(cls):
        from statsmodels.datasets.stackloss import load
        cls.data = load()  # class attributes for subclasses
        cls.data.exog = sm.add_constant(cls.data.exog, prepend=False)
        # Test precisions
        cls.decimal_standarderrors = DECIMAL_1
        cls.decimal_scale = DECIMAL_3

        results = RLM(cls.data.endog, cls.data.exog,\
                    M=sm.robust.norms.HuberT()).fit()   # default M
        h2 = RLM(cls.data.endog, cls.data.exog,\
                    M=sm.robust.norms.HuberT()).fit(cov="H2").bcov_scaled
        h3 = RLM(cls.data.endog, cls.data.exog,\
                    M=sm.robust.norms.HuberT()).fit(cov="H3").bcov_scaled
        cls.res1 = results
        cls.res1.h2 = h2
        cls.res1.h3 = h3
Ejemplo n.º 5
0
class TestRlmHuber(CheckRlmResultsMixin):
    from statsmodels.datasets.stackloss import load
    data = load()
    data.exog = sm.add_constant(data.exog, prepend=False)

    def __init__(self):
        results = RLM(self.data.endog, self.data.exog,\
                    M=sm.robust.norms.HuberT()).fit(scale_est=\
                    sm.robust.scale.HuberScale())
        h2 = RLM(self.data.endog, self.data.exog,\
                    M=sm.robust.norms.HuberT()).fit(cov="H2",
                    scale_est=sm.robust.scale.HuberScale()).bcov_scaled
        h3 = RLM(self.data.endog, self.data.exog,\
                    M=sm.robust.norms.HuberT()).fit(cov="H3",
                    scale_est=sm.robust.scale.HuberScale()).bcov_scaled
        self.res1 = results
        self.res1.h2 = h2
        self.res1.h3 = h3

    def setup(self):
        from .results.results_rlm import HuberHuber
        self.res2 = HuberHuber()
Ejemplo n.º 6
0
 def setup_class(cls):
     data = stackloss.load(as_pandas=False)
     data.exog = add_constant(data.exog)
     cls.res1 = OLS(data.endog, data.exog).fit()
     cls.res2 = RegressionResults()
Ejemplo n.º 7
0
#    results_huber = model_huber.fit(scale_est="stand_mad", update_scale=False)

#    model_ramsaysE = RLM(endog, exog, M=norms.RamsayE())
#    results_ramsaysE = model_ramsaysE.fit(update_scale=False)

#    model_andrewWave = RLM(endog, exog, M=norms.AndrewWave())
#    results_andrewWave = model_andrewWave.fit(update_scale=False)

#    model_hampel = RLM(endog, exog, M=norms.Hampel(a=1.7,b=3.4,c=8.5)) # convergence problems with scale changed, not with 2,4,8 though?
#    results_hampel = model_hampel.fit(update_scale=False)

#######################
### Stack Loss Data ###
#######################
    from statsmodels.datasets.stackloss import load
    data = load()
    data.exog = sm.add_constant(data.exog)
#############
### Huber ###
#############
#    m1_Huber = RLM(data.endog, data.exog, M=norms.HuberT())
#    results_Huber1 = m1_Huber.fit()
#    m2_Huber = RLM(data.endog, data.exog, M=norms.HuberT())
#    results_Huber2 = m2_Huber.fit(cov="H2")
#    m3_Huber = RLM(data.endog, data.exog, M=norms.HuberT())
#    results_Huber3 = m3_Huber.fit(cov="H3")
##############
### Hampel ###
##############
#    m1_Hampel = RLM(data.endog, data.exog, M=norms.Hampel())
#    results_Hampel1 = m1_Hampel.fit()
Ejemplo n.º 8
0
    #    results_huber = model_huber.fit(scale_est="stand_mad", update_scale=False)

    #    model_ramsaysE = RLM(endog, exog, M=norms.RamsayE())
    #    results_ramsaysE = model_ramsaysE.fit(update_scale=False)

    #    model_andrewWave = RLM(endog, exog, M=norms.AndrewWave())
    #    results_andrewWave = model_andrewWave.fit(update_scale=False)

    #    model_hampel = RLM(endog, exog, M=norms.Hampel(a=1.7,b=3.4,c=8.5)) # convergence problems with scale changed, not with 2,4,8 though?
    #    results_hampel = model_hampel.fit(update_scale=False)

    #######################
    ### Stack Loss Data ###
    #######################
    from statsmodels.datasets.stackloss import load
    data = load()
    data.exog = sm.add_constant(data.exog)
    #############
    ### Huber ###
    #############
    #    m1_Huber = RLM(data.endog, data.exog, M=norms.HuberT())
    #    results_Huber1 = m1_Huber.fit()
    #    m2_Huber = RLM(data.endog, data.exog, M=norms.HuberT())
    #    results_Huber2 = m2_Huber.fit(cov="H2")
    #    m3_Huber = RLM(data.endog, data.exog, M=norms.HuberT())
    #    results_Huber3 = m3_Huber.fit(cov="H3")
    ##############
    ### Hampel ###
    ##############
    #    m1_Hampel = RLM(data.endog, data.exog, M=norms.Hampel())
    #    results_Hampel1 = m1_Hampel.fit()
Ejemplo n.º 9
0
 def __init__(self):
     data = stackloss.load()
     data.exog = add_constant(data.exog)
     self.res1 = OLS(data.endog, data.exog).fit()
     self.res2 = RegressionResults()
Ejemplo n.º 10
0
    #    results_ols = model_ols.fit()

    #    model_ramsaysE = RLM(endog, exog, M=norms.RamsayE())
    #    results_ramsaysE = model_ramsaysE.fit(update_scale=False)

    #    model_andrewWave = RLM(endog, exog, M=norms.AndrewWave())
    #    results_andrewWave = model_andrewWave.fit(update_scale=False)

    #    model_hampel = RLM(endog, exog, M=norms.Hampel(a=1.7,b=3.4,c=8.5)) # convergence problems with scale changed, not with 2,4,8 though?
    #    results_hampel = model_hampel.fit(update_scale=False)

    #######################
    ### Stack Loss Data ###
    #######################
    from statsmodels.datasets.stackloss import load
    data = load(as_pandas=False)
    data.exog = sm.add_constant(data.exog)
    #############
    ### Huber ###
    #############
    #    m1_Huber = RLM(data.endog, data.exog, M=norms.HuberT())
    #    results_Huber1 = m1_Huber.fit()
    #    m2_Huber = RLM(data.endog, data.exog, M=norms.HuberT())
    #    results_Huber2 = m2_Huber.fit(cov="H2")
    #    m3_Huber = RLM(data.endog, data.exog, M=norms.HuberT())
    #    results_Huber3 = m3_Huber.fit(cov="H3")
    ##############
    ### Hampel ###
    ##############
    #    m1_Hampel = RLM(data.endog, data.exog, M=norms.Hampel())
    #    results_Hampel1 = m1_Hampel.fit()
Ejemplo n.º 11
0
#    results_ols = model_ols.fit()

#    model_ramsaysE = RLM(endog, exog, M=norms.RamsayE())
#    results_ramsaysE = model_ramsaysE.fit(update_scale=False)

#    model_andrewWave = RLM(endog, exog, M=norms.AndrewWave())
#    results_andrewWave = model_andrewWave.fit(update_scale=False)

#    model_hampel = RLM(endog, exog, M=norms.Hampel(a=1.7,b=3.4,c=8.5)) # convergence problems with scale changed, not with 2,4,8 though?
#    results_hampel = model_hampel.fit(update_scale=False)

#######################
### Stack Loss Data ###
#######################
    from statsmodels.datasets.stackloss import load
    data = load(as_pandas=False)
    data.exog = sm.add_constant(data.exog)
#############
### Huber ###
#############
#    m1_Huber = RLM(data.endog, data.exog, M=norms.HuberT())
#    results_Huber1 = m1_Huber.fit()
#    m2_Huber = RLM(data.endog, data.exog, M=norms.HuberT())
#    results_Huber2 = m2_Huber.fit(cov="H2")
#    m3_Huber = RLM(data.endog, data.exog, M=norms.HuberT())
#    results_Huber3 = m3_Huber.fit(cov="H3")
##############
### Hampel ###
##############
#    m1_Hampel = RLM(data.endog, data.exog, M=norms.Hampel())
#    results_Hampel1 = m1_Hampel.fit()
Ejemplo n.º 12
0
 def setup_class(cls):
     data = stackloss.load(as_pandas=False)
     data.exog = add_constant(data.exog)
     cls.res1 = OLS(data.endog, data.exog).fit()
     cls.res2 = RegressionResults()
Ejemplo n.º 13
0
Created on Sun Mar 27 14:36:40 2011

"""

import numpy as np
import statsmodels.api as sm
RLM = sm.RLM

DECIMAL_4 = 4
DECIMAL_3 = 3
DECIMAL_2 = 2
DECIMAL_1 = 1

from statsmodels.datasets.stackloss import load
data = load()   # class attributes for subclasses
data.exog = sm.add_constant(data.exog)

decimal_standarderrors = DECIMAL_1
decimal_scale = DECIMAL_3

results = RLM(data.endog, data.exog,\
            M=sm.robust.norms.HuberT()).fit()   # default M
h2 = RLM(data.endog, data.exog,\
            M=sm.robust.norms.HuberT()).fit(cov="H2").bcov_scaled
h3 = RLM(data.endog, data.exog,\
            M=sm.robust.norms.HuberT()).fit(cov="H3").bcov_scaled


from statsmodels.robust.tests.results.results_rlm import Huber
res2 = Huber()
Ejemplo n.º 14
0
"""

from __future__ import print_function
import numpy as np
import statsmodels.api as sm

RLM = sm.RLM

DECIMAL_4 = 4
DECIMAL_3 = 3
DECIMAL_2 = 2
DECIMAL_1 = 1

from statsmodels.datasets.stackloss import load

data = load(as_pandas=False)  # class attributes for subclasses
data.exog = sm.add_constant(data.exog, prepend=False)

decimal_standarderrors = DECIMAL_1
decimal_scale = DECIMAL_3

results = RLM(data.endog, data.exog,\
            M=sm.robust.norms.HuberT()).fit()   # default M
h2 = RLM(data.endog, data.exog,\
            M=sm.robust.norms.HuberT()).fit(cov="H2").bcov_scaled
h3 = RLM(data.endog, data.exog,\
            M=sm.robust.norms.HuberT()).fit(cov="H3").bcov_scaled

from statsmodels.robust.tests.results.results_rlm import Huber

res2 = Huber()
Ejemplo n.º 15
0
def load_stackloss():
    from statsmodels.datasets.stackloss import load
    data = load()
    data.endog = np.asarray(data.endog)
    data.exog = np.asarray(data.exog)
    return data
Ejemplo n.º 16
0
Created on Sun Mar 27 14:36:40 2011

"""

from __future__ import print_function
import numpy as np
import statsmodels.api as sm
RLM = sm.RLM

DECIMAL_4 = 4
DECIMAL_3 = 3
DECIMAL_2 = 2
DECIMAL_1 = 1

from statsmodels.datasets.stackloss import load
data = load(as_pandas=False)   # class attributes for subclasses
data.exog = sm.add_constant(data.exog, prepend=False)

decimal_standarderrors = DECIMAL_1
decimal_scale = DECIMAL_3

results = RLM(data.endog, data.exog,\
            M=sm.robust.norms.HuberT()).fit()   # default M
h2 = RLM(data.endog, data.exog,\
            M=sm.robust.norms.HuberT()).fit(cov="H2").bcov_scaled
h3 = RLM(data.endog, data.exog,\
            M=sm.robust.norms.HuberT()).fit(cov="H3").bcov_scaled


from statsmodels.robust.tests.results.results_rlm import Huber
res2 = Huber()