next up previous index
Next: Sampler Class Up: Model Components Previous: Regression Class   Index


EstimationProcedure Class

This class is an abstract class for modules that implement estimation of coefficients for one of the available models. bhhh_mnl_estimation implements the BHHH estimation algorithm for multinomial logit models and can be plugged into the ChoiceModel. As arguments, it gets a data array (of size number of observations $ \times$ number of alternatives $ \times$ number of variables) and an object upc_sequence. It uses the classes Probabilities and Utilities contained in upc_sequence for the maximum likelihood estimation. This assures that if bhhh_mnl_estimation is plugged into the estimate() method of ChoiceModel (Section 24.4.3), the model will be estimated by using the same code for computing utilities and probabilities as the run() method. The third argument of the run() method of this class is of type Resources and must contain an entry selected_choice which is a 0-1 matrix of size number of observations $ \times$ number of alternatives. For each agent, it contains a 1 on a position of the chosen alternative, otherwise 0s. Note that ChoiceModel prepares and passes this matrix automatically.

A child class of bhhh_mnl_estimation, called bhhh_wesml_mnl_estimation, implements the Weighted Endogenous Sampling Maximum Likelihood procedure, proposed by Manski, Lerman 1977. Here, the data are weighted by correction weights (observation share/sampled share) in order to take into account undersampled or oversampled observations. The correction weights should be implemented as a variable. Its fully-qualified name is passed to the run() method in the argument resources (dictionary) as an entry 'wesml_sampling_correction_variable'.

Classes bhhh_mnl_estimation_with_diagnose and bhhh_wesml_mnl_estimation_with_diagnose, respectively, run the estimation of their parent classes, namely bhhh_mnl_estimation and bhhh_wesml_mnl_estimation, respectively, using the utilities component linear_utilities_diagnose (see Section 24.5.1).

estimate_linear_regression performs a parameters estimation via the least squares method. As arguments, it gets a data array (of size number of observations $ \times$ number of variables), an instance of class Regression (not used in this module) and an object Resources. The last argument must contain an entry outcome which is a 1-d array of an outcome for each observation. This class can be plugged into the RegressionModel which takes care of all arguments.

estimate_linear_regression_r estimates the parameters using the R function lm. Here, the rpy module is required. It should give the same results as estimate_linear_regression.

The estimation modules return a dictionary with several entries: Entries estimators and standard_errors contain arrays of estimated coefficients and their standard errors, respectively. An entry other_measures is a dictionary which should contain additional measures of the estimates, i.e. their values should be arrays of the same size as estimators. The two estimation modules in opus_core return here one entry, namely the t_statistic. The last entry in the dictionary returned by the modules, other_info, is a dictionary containing additional information about the estimation. Its values don't follow any restriction on type and size. Thus, these can be also single values, such as likelihood ratio test statistics, degrees of freedom, $ R^2$ etc.

Opus also implements a tool for variable selection in linear regression. Class bma_for_linear_regression_r uses the R package BMA. It prints out results computed by the R function bic.glm and plots an image of the results. The input arguments are identical to those in estimate_linear_regression. Additionally, if the dictionary resources contains an entry 'bma_imageplot_filename', the resulting imageplot is stored as a pdf file of that name. The run() method does not return any value. It should serve users as a tool to select variables which can be then plugged into estimate_linear_regression. The module rpy is required when using this component.


next up previous index
Next: Sampler Class Up: Model Components Previous: Regression Class   Index
info (at) urbansim.org