当前位置: 首页>>代码示例>>Python>>正文


Python diagnostics.se_betas函数代码示例

本文整理汇总了Python中pysal.spreg.diagnostics.se_betas函数的典型用法代码示例。如果您正苦于以下问题:Python se_betas函数的具体用法?Python se_betas怎么用?Python se_betas使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了se_betas函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_init_white_

 def test_init_white_(self):
     X = []
     X.append(self.db.by_col("INC"))
     X.append(self.db.by_col("CRIME"))
     self.X = np.array(X).T
     base_gm_lag = GM_Lag(self.y, self.X, w=self.w, w_lags=2, robust='white')
     tbetas = np.array([[  4.53017056e+01], [  6.20888617e-01], [ -4.80723451e-01], [  2.83622122e-02]])
     np.testing.assert_array_almost_equal(base_gm_lag.betas, tbetas) 
     dbetas = D.se_betas(base_gm_lag)
     se_betas = np.array([ 20.47077481, 0.50613931, 0.20138425, 0.38028295 ])
     np.testing.assert_array_almost_equal(dbetas, se_betas)
开发者ID:denadai2,项目名称:pysal,代码行数:11,代码来源:test_twosls_sp.py

示例2: test_init_hac_

 def test_init_hac_(self):
     X = []
     X.append(self.db.by_col("INC"))
     X.append(self.db.by_col("CRIME"))
     self.X = np.array(X).T
     gwk = pysal.kernelW_from_shapefile(pysal.examples.get_path('columbus.shp'),k=15,function='triangular', fixed=False)        
     base_gm_lag = GM_Lag(self.y, self.X, w=self.w, w_lags=2, robust='hac', gwk=gwk)
     tbetas = np.array([[  4.53017056e+01], [  6.20888617e-01], [ -4.80723451e-01], [  2.83622122e-02]])
     np.testing.assert_array_almost_equal(base_gm_lag.betas, tbetas) 
     dbetas = D.se_betas(base_gm_lag)
     se_betas = np.array([ 19.08513569,   0.51769543,   0.18244862,   0.35460553])
     np.testing.assert_array_almost_equal(dbetas, se_betas)
开发者ID:denadai2,项目名称:pysal,代码行数:12,代码来源:test_twosls_sp.py

示例3: test_lag_q

 def test_lag_q(self):
     X = np.array(self.db.by_col("INC"))
     X = np.reshape(X, (49,1))
     yd = np.array(self.db.by_col("CRIME"))
     yd = np.reshape(yd, (49,1))
     q = np.array(self.db.by_col("DISCBD"))
     q = np.reshape(q, (49,1))
     reg = GM_Lag(self.y, X, w=self.w, yend=yd, q=q, w_lags=2, lag_q=False)
     tbetas = np.array( [[ 108.83261383], [  -0.48041099], [  -1.18950006], [  -0.56140186]])
     np.testing.assert_array_almost_equal(tbetas, reg.betas)
     dbetas = D.se_betas(reg)
     se_betas = np.array([ 58.33203837,   1.09100446,   0.62315167,   0.68088777])
     np.testing.assert_array_almost_equal(dbetas, se_betas)
开发者ID:denadai2,项目名称:pysal,代码行数:13,代码来源:test_twosls_sp.py

示例4: test_init_discbd

 def test_init_discbd(self):
     X = np.array(self.db.by_col("INC"))
     X = np.reshape(X, (49,1))
     yd = np.array(self.db.by_col("CRIME"))
     yd = np.reshape(yd, (49,1))
     q = np.array(self.db.by_col("DISCBD"))
     q = np.reshape(q, (49,1))
     reg = GM_Lag(self.y, X, w=self.w, yend=yd, q=q, w_lags=2)
     tbetas = np.array([[ 100.79359082], [  -0.50215501], [  -1.14881711], [  -0.38235022]])
     np.testing.assert_array_almost_equal(tbetas, reg.betas)
     dbetas = D.se_betas(reg)
     se_betas = np.array([ 53.0829123 ,   1.02511494,   0.57589064,   0.59891744 ])
     np.testing.assert_array_almost_equal(dbetas, se_betas)
开发者ID:denadai2,项目名称:pysal,代码行数:13,代码来源:test_twosls_sp.py

示例5: test_init_white_

 def test_init_white_(self):
     X = []
     X.append(self.db.by_col("INC"))
     X.append(self.db.by_col("CRIME"))
     self.X = np.array(X).T
     yd2, q2 = pysal.spreg.utils.set_endog(self.y, self.X, self.w, None, None, 2, True)
     self.X = np.hstack((np.ones(self.y.shape), self.X))
     self.X = SP.csr_matrix(self.X)
     base_gm_lag = BaseGM_Lag(self.y, self.X, yend=yd2, q=q2, w=self.w, w_lags=2, robust="white")
     tbetas = np.array([[4.53017056e01], [6.20888617e-01], [-4.80723451e-01], [2.83622122e-02]])
     np.testing.assert_array_almost_equal(base_gm_lag.betas, tbetas)
     dbetas = D.se_betas(base_gm_lag)
     se_betas = np.array([20.47077481, 0.50613931, 0.20138425, 0.38028295])
     np.testing.assert_array_almost_equal(dbetas, se_betas)
开发者ID:JoshuaSteele,项目名称:pysal,代码行数:14,代码来源:test_twosls_sp_sparse.py

示例6: test_init_hac_

 def test_init_hac_(self):
     w_lags = 2
     X = []
     X.append(self.db.by_col("INC"))
     X.append(self.db.by_col("CRIME"))
     self.X = np.array(X).T
     yd2, q2 = pysal.spreg.utils.set_endog(self.y, self.X, self.w, None, None, w_lags, True)
     self.X = np.hstack((np.ones(self.y.shape),self.X))
     gwk = pysal.kernelW_from_shapefile(pysal.examples.get_path('columbus.shp'),k=15,function='triangular', fixed=False)        
     base_gm_lag = BaseGM_Lag(self.y, self.X, yend=yd2, q=q2, w=self.w.sparse, w_lags=w_lags, robust='hac', gwk=gwk)
     tbetas = np.array([[  4.53017056e+01], [  6.20888617e-01], [ -4.80723451e-01], [  2.83622122e-02]])
     np.testing.assert_array_almost_equal(base_gm_lag.betas, tbetas) 
     dbetas = D.se_betas(base_gm_lag)
     se_betas = np.array([ 19.08513569,   0.51769543,   0.18244862,   0.35460553])
     np.testing.assert_array_almost_equal(dbetas, se_betas)
开发者ID:CartoDB,项目名称:pysal,代码行数:15,代码来源:test_twosls_sp.py

示例7: test_lag_q

 def test_lag_q(self):
     X = np.array(self.db.by_col("INC"))
     self.X = np.reshape(X, (49, 1))
     yd = np.array(self.db.by_col("CRIME"))
     yd = np.reshape(yd, (49, 1))
     q = np.array(self.db.by_col("DISCBD"))
     q = np.reshape(q, (49, 1))
     yd2, q2 = pysal.spreg.utils.set_endog(self.y, self.X, self.w, yd, q, 2, False)
     self.X = np.hstack((np.ones(self.y.shape), self.X))
     self.X = SP.csr_matrix(self.X)
     reg = BaseGM_Lag(self.y, self.X, yend=yd2, q=q2, w=self.w, w_lags=2, lag_q=False)
     tbetas = np.array([[108.83261383], [-0.48041099], [-1.18950006], [-0.56140186]])
     np.testing.assert_array_almost_equal(tbetas, reg.betas)
     dbetas = D.se_betas(reg)
     se_betas = np.array([58.33203837, 1.09100446, 0.62315167, 0.68088777])
     np.testing.assert_array_almost_equal(dbetas, se_betas)
开发者ID:JoshuaSteele,项目名称:pysal,代码行数:16,代码来源:test_twosls_sp_sparse.py

示例8: test_init_discbd

 def test_init_discbd(self):
     X = np.array(self.db.by_col("INC"))
     self.X = np.reshape(X, (49, 1))
     yd = np.array(self.db.by_col("CRIME"))
     yd = np.reshape(yd, (49, 1))
     q = np.array(self.db.by_col("DISCBD"))
     q = np.reshape(q, (49, 1))
     yd2, q2 = pysal.spreg.utils.set_endog(self.y, self.X, self.w, yd, q, 2, True)
     self.X = np.hstack((np.ones(self.y.shape), self.X))
     self.X = SP.csr_matrix(self.X)
     reg = BaseGM_Lag(self.y, self.X, yend=yd2, q=q2, w=self.w, w_lags=2)
     tbetas = np.array([[100.79359082], [-0.50215501], [-1.14881711], [-0.38235022]])
     np.testing.assert_array_almost_equal(tbetas, reg.betas)
     dbetas = D.se_betas(reg)
     se_betas = np.array([53.0829123, 1.02511494, 0.57589064, 0.59891744])
     np.testing.assert_array_almost_equal(dbetas, se_betas)
开发者ID:JoshuaSteele,项目名称:pysal,代码行数:16,代码来源:test_twosls_sp_sparse.py

示例9: regimes_printout

def regimes_printout(model):
    stds = diagnostics.se_betas(model)
    tp = np.array(diagnostics.t_stat(model))
    res = pd.DataFrame({'Coefficient': pd.Series(model.betas.flatten()), \
            'Std. Error': pd.Series(stds) , \
            'T-Stat': pd.Series(tp[:, 0].flatten()), \
            'P-value': pd.Series(tp[:, 1].flatten())})
    res = res.reindex(columns = ['Coefficient', 'Std. Error', 'T-Stat', 'P-value'])
    inds = []
    for lbl in model.name_x:
        r, v = lbl.split('_-_')
        inds.append((r, v))
    inds = np.array(inds)
    res['Regime'] = inds[:, 0]
    res['Variable'] = inds[:, 1]
    res = res.set_index(['Regime', 'Variable'])
    res[''] = res['P-value'].apply(star_significance)
    return res
开发者ID:GeoDaCenter,项目名称:GeoDaSpace,代码行数:18,代码来源:regimes_old.py

示例10: test_se_betas

 def test_se_betas(self):
     obs = diagnostics.se_betas(reg)
     exp = np.array([4.73548613, 0.33413076, 0.10319868])
     np.testing.assert_array_almost_equal(obs,exp)
开发者ID:PepSalehi,项目名称:pysal,代码行数:4,代码来源:test_diagnostics.py

示例11: test_se_betas

 def test_se_betas(self):
     obs = diagnostics.se_betas(reg)
     exp = np.array([4.73548613, 0.33413076, 0.10319868])
     np.testing.assert_allclose(obs,exp, RTOL)
开发者ID:lanselin,项目名称:pysal,代码行数:4,代码来源:test_diagnostics.py


注:本文中的pysal.spreg.diagnostics.se_betas函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。