Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.name_x += results[r].name_x
self.name_yend += results[r].name_yend
self.name_q += results[r].name_q
self.name_z += results[r].name_z
self.name_h += results[r].name_h
if add_lag != False:
self.predy_e[regi_ids[r], ] = results[r].predy_e
self.e_pred[regi_ids[r], ] = results[r].e_pred
counter += 1
self.chow = REGI.Chow(self)
self.multi = results
if add_lag != False:
SUMMARY.GM_Combo_Hom_multi(
reg=self, multireg=self.multi, vm=vm, regimes=True)
else:
SUMMARY.GM_Endog_Error_Hom_multi(
reg=self, multireg=self.multi, vm=vm, regimes=True)
n = USER.check_arrays(y, x)
USER.check_y(y, n)
USER.check_weights(w, y)
USER.check_robust(robust, gwk)
USER.check_spat_diag(spat_diag, w)
x_constant = USER.check_constant(x)
BaseOLS.__init__(self, y=y, x=x_constant, robust=robust,
gwk=gwk, sig2n_k=sig2n_k)
self.title = "ORDINARY LEAST SQUARES"
self.name_ds = USER.set_name_ds(name_ds)
self.name_y = USER.set_name_y(name_y)
self.name_x = USER.set_name_x(name_x, x)
self.robust = USER.set_robust(robust)
self.name_w = USER.set_name_w(name_w, w)
self.name_gwk = USER.set_name_w(name_gwk, gwk)
SUMMARY.OLS(reg=self, vm=vm, w=w, nonspat_diag=nonspat_diag,
spat_diag=spat_diag, moran=moran, white_test=white_test)
yend2[:, -1].reshape(self.n, 1), self.rho)
set_warn(self, warn)
self.title = "SPATIALLY WEIGHTED TWO STAGE LEAST SQUARES (HOM)"
self.name_ds = USER.set_name_ds(name_ds)
self.name_y = USER.set_name_y(name_y)
self.name_x = USER.set_name_x(name_x, x)
self.name_yend = USER.set_name_yend(name_yend, yend)
self.name_yend.append(USER.set_name_yend_sp(self.name_y))
self.name_z = self.name_x + self.name_yend
self.name_z.append('lambda') # listing lambda last
self.name_q = USER.set_name_q(name_q, q)
self.name_q.extend(
USER.set_name_q_sp(self.name_x, w_lags, self.name_q, lag_q))
self.name_h = USER.set_name_h(self.name_x, self.name_q)
self.name_w = USER.set_name_w(name_w, w)
SUMMARY.GM_Combo_Hom(reg=self, w=w, vm=vm)
self.iteration += 1
self.iter_stop = UTILS.iter_msg(self.iteration, max_iter)
sigma = get_psi_sigma(w.sparse, self.u, lambda3)
vc3 = get_vc_het(w.sparse, wA1, sigma)
self.vm = get_vm_het(moments_i[0], lambda3, self, w.sparse, vc3)
self.betas = np.vstack((ols_s.betas, lambda3))
self.e_filtered = self.u - lambda3 * lag_spatial(w, self.u)
self.title = "SPATIALLY WEIGHTED LEAST SQUARES (HET) - REGIMES"
self.name_x.append('lambda')
self.kf += 1
self.chow = REGI.Chow(self)
self._cache = {}
SUMMARY.GM_Error_Het(reg=self, w=w, vm=vm, regimes=True)
regimes=regimes, w=w, robust=robust, gwk=gwk,
sig2n_k=sig2n_k, spat_diag=spat_diag, vm=vm,
constant_regi=constant_regi, cols2regi=cols2regi, regime_err_sep=regime_err_sep,
name_y=name_y, name_x=name_x, name_yend=name_yend, name_q=name_q,
name_regimes=name_regimes, name_w=name_w, name_gwk=name_gwk,
name_ds=name_ds, summ=False)
if regime_lag_sep:
self.sp_att_reg(w_i, regi_ids, yend2[:, -1].reshape(self.n, 1))
else:
self.rho = self.betas[-1]
self.predy_e, self.e_pred, warn = sp_att(w, self.y, self.predy,
yend2[:, -1].reshape(self.n, 1), self.rho)
set_warn(self, warn)
self.regime_lag_sep = regime_lag_sep
self.title = "SPATIAL " + self.title
SUMMARY.GM_Lag(
reg=self, w=w, vm=vm, spat_diag=spat_diag, regimes=True)
self.name_h += results[r].name_h
if r == self.regimes_set[0]:
self.hac_var = np.zeros((self.n, results[r].h.shape[1]), float)
self.hac_var[regi_ids[r], ] = results[r].h
counter += 1
self.multi = results
if robust == 'hac':
hac_multi(self, gwk, constant=True)
if robust == 'ogmm':
set_warn(
self, "Residuals treated as homoskedastic for the purpose of diagnostics.")
self.chow = REGI.Chow(self)
if spat_diag:
pass
#self._get_spat_diag_props(y, x, w, yend, q, w_lags, lag_q)
SUMMARY.GM_Lag_multi(
reg=self, multireg=self.multi, vm=vm, spat_diag=spat_diag, regimes=True, w=w)
else:
results[r] = results_p[r].get()
self.vm[(counter * self.kr):((counter + 1) * self.kr),
(counter * self.kr):((counter + 1) * self.kr)] = results[r].vm
self.betas[
(counter * self.kr):((counter + 1) * self.kr), ] = results[r].betas
self.u[regi_ids[r], ] = results[r].u
self.predy[regi_ids[r], ] = results[r].predy
self.e_filtered[regi_ids[r], ] = results[r].e_filtered
self.name_y += results[r].name_y
self.name_x += results[r].name_x
counter += 1
self.chow = REGI.Chow(self)
self.multi = results
SUMMARY.ML_Error_multi(
reg=self, multireg=self.multi, vm=vm, spat_diag=spat_diag, regimes=True, w=w)
self.name_yend += results[r].name_yend
self.name_q += results[r].name_q
self.name_z += results[r].name_z
self.name_h += results[r].name_h
counter += 1
self.multi = results
self.hac_var = sphstack(x, q)
if robust == 'hac':
hac_multi(self, gwk)
if robust == 'ogmm':
set_warn(
self, "Residuals treated as homoskedastic for the purpose of diagnostics.")
self.chow = REGI.Chow(self)
if spat_diag:
self._get_spat_diag_props(results, regi_ids, x, yend, q)
SUMMARY.TSLS_multi(
reg=self, multireg=self.multi, vm=vm, spat_diag=spat_diag, regimes=True, w=w)
x, name_x = REGI.Regimes_Frame.__init__(self, x_constant,
regimes, constant_regi=None, cols2regi=cols2regi,
names=name_x)
BaseML_Error.__init__(
self, y=y, x=x, w=w, method=method, epsilon=epsilon, regimes_att=regimes_att)
self.title = "MAXIMUM LIKELIHOOD SPATIAL ERROR - REGIMES" + \
" (METHOD = " + method + ")"
self.name_x = USER.set_name_x(name_x, x, constant=True)
self.name_x.append('lambda')
self.kf += 1 # Adding a fixed k to account for lambda.
self.chow = REGI.Chow(self)
self.aic = DIAG.akaike(reg=self)
self.schwarz = DIAG.schwarz(reg=self)
SUMMARY.ML_Error(
reg=self, w=w, vm=vm, spat_diag=spat_diag, regimes=True)
self.predy[regi_ids[r], ] = results[r].predy
self.e_filtered[regi_ids[r], ] = results[r].e_filtered
self.name_y += results[r].name_y
self.name_x += results[r].name_x
self.name_yend += results[r].name_yend
self.name_q += results[r].name_q
self.name_z += results[r].name_z
self.name_h += results[r].name_h
if add_lag != False:
self.predy_e[regi_ids[r], ] = results[r].predy_e
self.e_pred[regi_ids[r], ] = results[r].e_pred
counter += 1
self.chow = REGI.Chow(self)
self.multi = results
if add_lag != False:
SUMMARY.GM_Combo_Het_multi(
reg=self, multireg=self.multi, vm=vm, regimes=True)
else:
SUMMARY.GM_Endog_Error_Het_multi(
reg=self, multireg=self.multi, vm=vm, regimes=True)