Closed darribas closed 2 years ago
Using the tutorial example:
import numpy, pandas, libpysal, spreg # Read Baltimore data db = libpysal.io.open(libpysal.examples.get_path("baltim.dbf"), "r") ds_name = "baltim.dbf" # Read dependent variable y_name = "PRICE" y = numpy.array(db.by_col(y_name)).T y = y[:, numpy.newaxis] # Read exogenous variables x_names = ["NROOM", "NBATH", "PATIO", "FIREPL", "AC", "GAR", "AGE", "LOTSZ", "SQFT"] x = numpy.array([db.by_col(var) for var in x_names]).T # Read spatial data ww = libpysal.io.open(libpysal.examples.get_path("baltim_q.gal")) w = ww.read() ww.close() w_name = "baltim_q.gal" w.transform = "r" model = spreg.GM_Error_Het( y, x, w=w, name_y=y_name, name_x=x_names, name_w="baltim_q", ) print(model.summary)
Returns the following printout:
REGRESSION ---------- SUMMARY OF OUTPUT: SPATIALLY WEIGHTED LEAST SQUARES (HET) --------------------------------------------------------- Data set : unknown Weights matrix : baltim_q Dependent Variable : PRICE Number of Observations: 211 Mean dependent var : 44.3072 Number of Variables : 10 S.D. dependent var : 23.6061 Degrees of Freedom : 201 Pseudo R-squared : 0.6467 N. of iterations : 1 Step1c computed : No ------------------------------------------------------------------------------------ Variable Coefficient Std.Error z-Statistic Probability ------------------------------------------------------------------------------------ CONSTANT 20.0732495 6.7858988 2.9580827 0.0030956 NROOM 1.0932756 1.3744184 0.7954460 0.4263541 NBATH 6.3277367 2.3902173 2.6473479 0.0081126 PATIO 8.3002828 3.3887765 2.4493450 0.0143116 FIREPL 9.1325847 2.6462219 3.4511787 0.0005581 AC 6.7053204 3.1584166 2.1230006 0.0337538 GAR 4.4574380 2.7187407 1.6395230 0.1011044 AGE -0.1812099 0.1290087 -1.4046330 0.1601304 LOTSZ 0.0856008 0.0258313 3.3138441 0.0009202 SQFT 0.1111843 0.2172385 0.5118076 0.6087857 lambda 0.4716553 0.0942220 5.0057882 0.0000006 lambda 0.4716553 0.0942220 5.0057882 0.0000006 ------------------------------------------------------------------------------------ ================================ END OF REPORT =====================================
summary
betas
name_x
Versions:
libpysal = '4.4.0'
spreg = '1.2.2'
Using the tutorial example:
Returns the following printout:
I think this is only in the
summary
printout, thebetas
,name_x
and related vectors are correct.Versions:
libpysal = '4.4.0'
spreg = '1.2.2'