next up previous index
Next: Simulation Up: Regression Model Previous: Initialization   Index

Estimation

The specification for the above example consists of one variable and one constant for the intercept:
>>> specification = EquationSpecification(
                          variables=array(["constant", "gridcell.distance_to_cbd"]),
                          coefficients=array(["constant", "dcbd_coef"]))
The estimation for predicting the cost of living is run by:
>> coef, other_results = rm.estimate(specification, dataset=locations,
                              outcome_attribute="gridcell.cost",
                              procedure="opus_core.estimate_linear_regression")
Estimating Regression Model (from opus_core.regression_model):
                                            started on Mon Mar 19 21:14:33 2007
    Estimate regression for submodel -2
    Number of observations: 9
    R-Squared:             0.536420010196
    Adjusted R-Squared:    0.470194297367
    Suggested |t-value| >  1.48230380737
    -----------------------------------------------
    Coeff_names estimate        SE      t-values
      constant   1114.07         213.758         5.21183
     dcbd_coef  -71.1493         24.9995        -2.84603
    ===============================================

Estimating Regression Model (from opus_core.regression_model): completed...0.4 sec
The estimation procedure that is passed as an argument is expected to be a child of EstimationProcedure (see Section 22.5.6) and have a method run() that takes as arguments a multidimensional data array and an instance of a class specified by the argument regression_procedure in the model constructor. Thus, the estimation procedure can use the same code that is used for simulation.

The resulting object of class Coefficients called coef can be stored or directly used for predicting cost of other locations.

>>> coef.summary()
Coefficient object:
size: 2
names: ['constant' 'dcbd_coef']
values:
[ 1114.07348633   -71.14933777]
standard errors:
[ 213.75848389   24.99952126]
t_statistic:
[ 5.211833   -2.84602809]
submodels: [-2 -2]


next up previous index
Next: Simulation Up: Regression Model Previous: Initialization   Index
info (at) urbansim.org