Creating Better Places with Transportation Demand Management (TDM)
Phd Program in Transportation Transport Demand Modeling · Phd Program in Transportation Transport...
Transcript of Phd Program in Transportation Transport Demand Modeling · Phd Program in Transportation Transport...
Phd in Transportation / Transport Demand Modelling 1/60
Phd Program in Transportation
Transport Demand Modeling
João de Abreu e Silva
Session 10 Binary and Ordered Choice Models
Phd in Transportation / Transport Demand Modelling 2/60
Uses of binary and ordered models
Binary and ordered dependent variables are quite common in
transportation planning:
Binary
Mode choice (when only two alternatives exist);
Ordered
Car ownership levels in households;
Quantitative rankings;
Satisfaction levels (using likert scales);
Accident severity levels;
Phd in Transportation / Transport Demand Modelling 3/60
Discrete choice and Utility theory
It is useful to link the statistical model to an underlying theoretical
construct.
Discrete outcome models have been tied to utility theory.
Traditional approaches from microeconomic theory have decision
makers choosing among a set of alternatives such that their utility
(satisfaction) is maximized subject to the prices of the alternatives
and an income constraint.
Problem – any purchase affects other purchases (they are not
independent)
It is possible to assume that the consumption among different groups
of products is independent - Separability. E.g. choice of cereal brand
and car purchase.
Phd in Transportation / Transport Demand Modelling 4/60
Random utility and ordered models
Random Utility for an ordered choice might be formulated in the
following way:
Which could be easily transformed in a binary choice
Phd in Transportation / Transport Demand Modelling 5/60
Binary choice models
Replacing b’x-m6 by g’xi (the constant term is included in both).
We could have the following regression in which y*i is a latent
(unobserved variable)
Phd in Transportation / Transport Demand Modelling 6/60
Binary choice models
The probabilities are bounded between 0 and 1
The probability increases when g’xi increases
The distribution for the error term defines the type of model
Binary probit – the distribution for ei is normal
Binary logit – the distribution for ei is logistic
Phd in Transportation / Transport Demand Modelling 7/60
Binary choice models
F is the cumulative distribution function
Both the normal and the logistic distributions are symmetric
Phd in Transportation / Transport Demand Modelling 8/60
Identification
We are assuming that the error term has a zero mean and variance equal to 1 or
p2/3 (logit) – Normalizations of the model
Considering explicitly the constants and considering that the average for the error
term is q
As long as we have a constant term the model doesn´t loose its generality
Because the results in the model (yi) are only zeros and ones there is an
indeterminacy. To remove it is conventional to use the above referred values for the
variance
Phd in Transportation / Transport Demand Modelling 9/60
Maximum Likelihood estimation
For the Probit Model the LL function is
Phd in Transportation / Transport Demand Modelling 10/60
Marginal Effects
Marginal effects
The model parameters could be used to estimate partial changes in
the probabilities, altough not directly as in the linear regression
The marginal effects for
Probit
Logit
Phd in Transportation / Transport Demand Modelling 11/60
Marginal Effects
The magnitude of the marginal effects depends also on the other
variables and coefficients. They depend were the calculation is made
Phd in Transportation / Transport Demand Modelling 12/60
Odds ratios
The odds in favor of a certain response are for the logit
If z changes in one unit
For a change of 1 in z the odds are expected to change by a factor of
exp(q), holding all other variables constant.
Phd in Transportation / Transport Demand Modelling 13/60
Elasticities
Elasticities are common in transportation studies
Because they a ratio of percentage change elasticities cannot be
computed for dummy variables. For these semi-elasticities should be
computed (the denominator is equal to 1).
The denominator computation removes the asymmetry in the computation (not dependent
on whether the change is from di = 1 to 0 or from 0 to 1).
Phd in Transportation / Transport Demand Modelling 14/60
Inference about the parameters
Inference about coefficients is based on the standard “z” test:
Phd in Transportation / Transport Demand Modelling 15/60
Wald test
When the objective is to test more than one coefficient
simultaneously the Wald test is used.
E.g. test if two coefficients are simultaneously equal to zero
The result is a chi squared statistic with degrees of freedom equal to
the number of restrictions.
Where R is a matrix of coefficients in the linear restrictions, q is a vector
of constants
Phd in Transportation / Transport Demand Modelling 16/60
Likelihood ratio test
The likelihood ratio test is used to test if the model is a statistical
improvement over a base model (null or restricted model).
The statistic has a limiting chi squared distribution with degrees of
freedom equal to the number of restrictions being tested.
The likelihood ratio test that all the slope coefficients in the probit or
logit model are zero. “Similar” to the F test.
Where P1 is the proportion of the observations that have dependent variable equal to 1.
Phd in Transportation / Transport Demand Modelling 17/60
Likelihood ratio test
The likelihood ratio test provides a more convenient approach for
testing homogeneity of strata in the data. E.g. if it makes sense to
build different models for both genders.
The statistic has a limiting chi squared distribution with degrees of
freedom equal to g-1 times the number of parameters in the model.
The null hypothesis states that the same ordered choice model
applies to both strata.
Phd in Transportation / Transport Demand Modelling 18/60
Fit measures
Pseudo R2
Adjusted Pseudo R2
M is the number of parameters in the model
Phd in Transportation / Transport Demand Modelling 19/60
Binary model - example
Data from Tomar 2003/2004, 250 observations.
Evaluate Car use in home based trips as a function of socioeconomic and land use
patterns
TI – dependent variable (1 if car was used, 0 otherwise)
IDADE – age of the respondent
SEXO – gender (1 if man)
FDIM – Household dimension
DENS – population density in the residence zone
DEFEST – parking deficit (1 if yes)
NADUL – number of adults in the household
AIDM – average age of the adults
EMP – employed (1 if respondent was employed)
Phd in Transportation / Transport Demand Modelling 20/60
Binary model - example
Binary Probit Probit
;Lhs = dependent variable
;Rhs = One,independent variables (separated by commas)$ +---------------------------------------------+
| Binomial Probit Model |
| Maximum Likelihood Estimates |
| Model estimated: Oct 26, 2010 at 00:48:18PM.|
| Dependent variable TI |
| Weighting variable None |
| Number of observations 250 |
| Iterations completed 5 |
| Log likelihood function -142.0311 |
| Number of parameters 9 |
| Info. Criterion: AIC = 1.20825 |
| Finite Sample: AIC = 1.21125 |
| Info. Criterion: BIC = 1.33502 |
| Info. Criterion:HQIC = 1.25927 |
| Restricted log likelihood -160.9133 |
| McFadden Pseudo R-squared .1173439 |
| Chi squared 37.76438 |
| Degrees of freedom 8 |
| Prob[ChiSqd > value] = .8320901E-05 |
| Hosmer-Lemeshow chi-squared = 16.78439 |
| P-value= .03243 with deg.fr. = 8 |
+---------------------------------------------+
Phd in Transportation / Transport Demand Modelling 21/60
Binary model - example
+--------+--------------+----------------+--------+--------+----------+
|Variable| Coefficient | Standard Error |b/St.Er.|P[|Z|>z]| Mean of X|
+--------+--------------+----------------+--------+--------+----------+
---------+Index function for probability
Constant| 2.17768691 .66808320 3.260 .0011
IDADE | .00812010 .00947338 .857 .3914 43.0720000
SEXO | .40306615 .17845407 2.259 .0239 .45200000
FDIM | .27558566 .12660998 2.177 .0295 2.97200000
DENS | -.60699476 .23250165 -2.611 .0090 .45024000
DEFEST | -.42731158 .20151556 -2.120 .0340 .22400000
NADUL | -.62465667 .15963162 -3.913 .0001 2.39600000
AIDM | -.02408234 .01251624 -1.924 .0543 43.0200000
EMP | -.26631548 .22087316 -1.206 .2279 .65200000
Phd in Transportation / Transport Demand Modelling 22/60
Binary model - example
+----------------------------------------+
| Fit Measures for Binomial Choice Model |
| Probit model for variable TI |
+----------------------------------------+
| Proportions P0= .344000 P1= .656000 |
| N = 250 N0= 86 N1= 164 |
| LogL= -142.031 LogL0= -160.913 |
| Estrella = 1-(L/L0)^(-2L0/n) = .14844 |
+----------------------------------------+
| Efron | McFadden | Ben./Lerman |
| .13421 | .11734 | .61239 |
| Cramer | Veall/Zim. | Rsqrd_ML |
| .14114 | .23318 | .14020 |
+----------------------------------------+
| Information Akaike I.C. Schwarz I.C. |
| Criteria 1.20825 1.33502 |
+----------------------------------------+
+---------------------------------------------------------+
|Predictions for Binary Choice Model. Predicted value is |
|1 when probability is greater than .500000, 0 otherwise.|
|Note, column or row total percentages may not sum to |
|100% because of rounding. Percentages are of full sample.|
+------+---------------------------------+----------------+
|Actual| Predicted Value | |
|Value | 0 1 | Total Actual |
+------+----------------+----------------+----------------+
| 0 | 32 ( 12.8%)| 54 ( 21.6%)| 86 ( 34.4%)|
| 1 | 20 ( 8.0%)| 144 ( 57.6%)| 164 ( 65.6%)|
+------+----------------+----------------+----------------+
|Total | 52 ( 20.8%)| 198 ( 79.2%)| 250 (100.0%)|
+------+----------------+----------------+----------------+
=======================================================================
Analysis of Binary Choice Model Predictions Based on Threshold = .5000
-----------------------------------------------------------------------
Prediction Success
-----------------------------------------------------------------------
Sensitivity = actual 1s correctly predicted 87.805%
Specificity = actual 0s correctly predicted 37.209%
Positive predictive value = predicted 1s that were actual 1s 72.727%
Negative predictive value = predicted 0s that were actual 0s 61.538%
Correct prediction = actual 1s and 0s correctly predicted 70.400%
-----------------------------------------------------------------------
Prediction Failure
-----------------------------------------------------------------------
False pos. for true neg. = actual 0s predicted as 1s 62.791%
False neg. for true pos. = actual 1s predicted as 0s 12.195%
False pos. for predicted pos. = predicted 1s actual 0s 27.273%
False neg. for predicted neg. = predicted 0s actual 1s 38.462%
False predictions = actual 1s and 0s incorrectly predicted 29.600%
=======================================================================
Phd in Transportation / Transport Demand Modelling 23/60
Binary model - example
+----------------------------------------+
| Fit Measures for Binomial Choice Model |
| Probit model for variable TI |
+----------------------------------------+
| Proportions P0= .344000 P1= .656000 |
| N = 250 N0= 86 N1= 164 |
| LogL= -142.031 LogL0= -160.913 |
| Estrella = 1-(L/L0)^(-2L0/n) = .14844 |
+----------------------------------------+
| Efron | McFadden | Ben./Lerman |
| .13421 | .11734 | .61239 |
| Cramer | Veall/Zim. | Rsqrd_ML |
| .14114 | .23318 | .14020 |
+----------------------------------------+
| Information Akaike I.C. Schwarz I.C. |
| Criteria 1.20825 1.33502 |
+----------------------------------------+
+---------------------------------------------------------+
|Predictions for Binary Choice Model. Predicted value is |
|1 when probability is greater than .500000, 0 otherwise.|
|Note, column or row total percentages may not sum to |
|100% because of rounding. Percentages are of full sample.|
+------+---------------------------------+----------------+
|Actual| Predicted Value | |
|Value | 0 1 | Total Actual |
+------+----------------+----------------+----------------+
| 0 | 32 ( 12.8%)| 54 ( 21.6%)| 86 ( 34.4%)|
| 1 | 20 ( 8.0%)| 144 ( 57.6%)| 164 ( 65.6%)|
+------+----------------+----------------+----------------+
|Total | 52 ( 20.8%)| 198 ( 79.2%)| 250 (100.0%)|
+------+----------------+----------------+----------------+
=======================================================================
Analysis of Binary Choice Model Predictions Based on Threshold = .5000
-----------------------------------------------------------------------
Prediction Success
-----------------------------------------------------------------------
Sensitivity = actual 1s correctly predicted 87.805%
Specificity = actual 0s correctly predicted 37.209%
Positive predictive value = predicted 1s that were actual 1s 72.727%
Negative predictive value = predicted 0s that were actual 0s 61.538%
Correct prediction = actual 1s and 0s correctly predicted 70.400%
-----------------------------------------------------------------------
Prediction Failure
-----------------------------------------------------------------------
False pos. for true neg. = actual 0s predicted as 1s 62.791%
False neg. for true pos. = actual 1s predicted as 0s 12.195%
False pos. for predicted pos. = predicted 1s actual 0s 27.273%
False neg. for predicted neg. = predicted 0s actual 1s 38.462%
False predictions = actual 1s and 0s incorrectly predicted 29.600%
=======================================================================
Phd in Transportation / Transport Demand Modelling 24/60
Binary model - example
Binary Logit Logit
;Lhs = dependent variable
;Rhs = One,independent variables (separated by commas)$
+---------------------------------------------+
| Binary Logit Model for Binary Choice |
| Maximum Likelihood Estimates |
| Model estimated: Oct 26, 2010 at 00:48:18PM.|
| Dependent variable TI |
| Weighting variable None |
| Number of observations 250 |
| Iterations completed 5 |
| Log likelihood function -142.3632 |
| Number of parameters 9 |
| Info. Criterion: AIC = 1.21091 |
| Finite Sample: AIC = 1.21391 |
| Info. Criterion: BIC = 1.33768 |
| Info. Criterion:HQIC = 1.26193 |
| Restricted log likelihood -160.9133 |
| McFadden Pseudo R-squared .1152801 |
| Chi squared 37.10019 |
| Degrees of freedom 8 |
| Prob[ChiSqd > value] = .1103005E-04 |
| Hosmer-Lemeshow chi-squared = 15.75682 |
| P-value= .04600 with deg.fr. = 8 |
+---------------------------------------------+
Phd in Transportation / Transport Demand Modelling 25/60
Binary model - example
+--------+--------------+----------------+--------+--------+----------+
|Variable| Coefficient | Standard Error |b/St.Er.|P[|Z|>z]| Mean of X|
+--------+--------------+----------------+--------+--------+----------+
---------+Characteristics in numerator of Prob[Y = 1]
Constant| 3.59537669 1.13332753 3.172 .0015
IDADE | .01325360 .01562042 .848 .3962 43.0720000
SEXO | .66921981 .29950572 2.234 .0255 .45200000
FDIM | .43930887 .21328635 2.060 .0394 2.97200000
DENS | -.98707555 .38885378 -2.538 .0111 .45024000
DEFEST | -.69848440 .33199452 -2.104 .0354 .22400000
NADUL | -1.00721380 .26843054 -3.752 .0002 2.39600000
AIDM | -.03992124 .02069419 -1.929 .0537 43.0200000
EMP | -.45643740 .37192597 -1.227 .2197 .65200000
+--------------------------------------------------------------------+
| Information Statistics for Discrete Choice Model. |
| M=Model MC=Constants Only M0=No Model |
| Criterion F (log L) -142.36317 -160.91327 -173.28680 |
| LR Statistic vs. MC 37.10019 .00000 .00000 |
| Degrees of Freedom 8.00000 .00000 .00000 |
| Prob. Value for LR .00001 .00000 .00000 |
| Entropy for probs. 142.36317 160.91327 173.28680 |
| Normalized Entropy .82155 .92860 1.00000 |
| Entropy Ratio Stat. 61.84724 24.74705 .00000 |
| Bayes Info Criterion 1.31559 1.46399 1.56298 |
| BIC(no model) - BIC .24739 .09899 .00000 |
| Pseudo R-squared .11528 .00000 .00000 |
| Pct. Correct Pred. 70.40000 .00000 50.00000 |
| Means: y=0 y=1 y=2 y=3 y=4 y=5 y=6 y>=7 |
| Outcome .3440 .6560 .0000 .0000 .0000 .0000 .0000 .0000 |
| Pred.Pr .3440 .6560 .0000 .0000 .0000 .0000 .0000 .0000 |
| Notes: Entropy computed as Sum(i)Sum(j)Pfit(i,j)*logPfit(i,j). |
| Normalized entropy is computed against M0. |
| Entropy ratio statistic is computed against M0. |
| BIC = 2*criterion - log(N)*degrees of freedom. |
| If the model has only constants or if it has no constants, |
| the statistics reported here are not useable. |
+--------------------------------------------------------------------+
Phd in Transportation / Transport Demand Modelling 26/60
Binary model - example
+--------+--------------+----------------+--------+--------+----------+
|Variable| Coefficient | Standard Error |b/St.Er.|P[|Z|>z]| Mean of X|
+--------+--------------+----------------+--------+--------+----------+
---------+Characteristics in numerator of Prob[Y = 1]
Constant| 3.59537669 1.13332753 3.172 .0015
IDADE | .01325360 .01562042 .848 .3962 43.0720000
SEXO | .66921981 .29950572 2.234 .0255 .45200000
FDIM | .43930887 .21328635 2.060 .0394 2.97200000
DENS | -.98707555 .38885378 -2.538 .0111 .45024000
DEFEST | -.69848440 .33199452 -2.104 .0354 .22400000
NADUL | -1.00721380 .26843054 -3.752 .0002 2.39600000
AIDM | -.03992124 .02069419 -1.929 .0537 43.0200000
EMP | -.45643740 .37192597 -1.227 .2197 .65200000
+--------------------------------------------------------------------+
| Information Statistics for Discrete Choice Model. |
| M=Model MC=Constants Only M0=No Model |
| Criterion F (log L) -142.36317 -160.91327 -173.28680 |
| LR Statistic vs. MC 37.10019 .00000 .00000 |
| Degrees of Freedom 8.00000 .00000 .00000 |
| Prob. Value for LR .00001 .00000 .00000 |
| Entropy for probs. 142.36317 160.91327 173.28680 |
| Normalized Entropy .82155 .92860 1.00000 |
| Entropy Ratio Stat. 61.84724 24.74705 .00000 |
| Bayes Info Criterion 1.31559 1.46399 1.56298 |
| BIC(no model) - BIC .24739 .09899 .00000 |
| Pseudo R-squared .11528 .00000 .00000 |
| Pct. Correct Pred. 70.40000 .00000 50.00000 |
| Means: y=0 y=1 y=2 y=3 y=4 y=5 y=6 y>=7 |
| Outcome .3440 .6560 .0000 .0000 .0000 .0000 .0000 .0000 |
| Pred.Pr .3440 .6560 .0000 .0000 .0000 .0000 .0000 .0000 |
| Notes: Entropy computed as Sum(i)Sum(j)Pfit(i,j)*logPfit(i,j). |
| Normalized entropy is computed against M0. |
| Entropy ratio statistic is computed against M0. |
| BIC = 2*criterion - log(N)*degrees of freedom. |
| If the model has only constants or if it has no constants, |
| the statistics reported here are not useable. |
+--------------------------------------------------------------------+
Phd in Transportation / Transport Demand Modelling 27/60
Binary model - example +----------------------------------------+
| Fit Measures for Binomial Choice Model |
| Logit model for variable TI |
+----------------------------------------+
| Proportions P0= .344000 P1= .656000 |
| N = 250 N0= 86 N1= 164 |
| LogL= -142.363 LogL0= -160.913 |
| Estrella = 1-(L/L0)^(-2L0/n) = .14587 |
+----------------------------------------+
| Efron | McFadden | Ben./Lerman |
| .13396 | .11528 | .61110 |
| Cramer | Veall/Zim. | Rsqrd_ML |
| .13831 | .22961 | .13791 |
+----------------------------------------+
| Information Akaike I.C. Schwarz I.C. |
| Criteria 1.21091 1.33768 |
+----------------------------------------+
+---------------------------------------------------------+
|Predictions for Binary Choice Model. Predicted value is |
|1 when probability is greater than .500000, 0 otherwise.|
|Note, column or row total percentages may not sum to |
|100% because of rounding. Percentages are of full sample.|
+------+---------------------------------+----------------+
|Actual| Predicted Value | |
|Value | 0 1 | Total Actual |
+------+----------------+----------------+----------------+
| 0 | 31 ( 12.4%)| 55 ( 22.0%)| 86 ( 34.4%)|
| 1 | 19 ( 7.6%)| 145 ( 58.0%)| 164 ( 65.6%)|
+------+----------------+----------------+----------------+
|Total | 50 ( 20.0%)| 200 ( 80.0%)| 250 (100.0%)|
+------+----------------+----------------+----------------+
Phd in Transportation / Transport Demand Modelling 28/60
Binary model - example
=======================================================================
Analysis of Binary Choice Model Predictions Based on Threshold = .5000
-----------------------------------------------------------------------
Prediction Success
-----------------------------------------------------------------------
Sensitivity = actual 1s correctly predicted 88.415%
Specificity = actual 0s correctly predicted 36.047%
Positive predictive value = predicted 1s that were actual 1s 72.500%
Negative predictive value = predicted 0s that were actual 0s 62.000%
Correct prediction = actual 1s and 0s correctly predicted 70.400%
-----------------------------------------------------------------------
Prediction Failure
-----------------------------------------------------------------------
False pos. for true neg. = actual 0s predicted as 1s 63.953%
False neg. for true pos. = actual 1s predicted as 0s 11.585%
False pos. for predicted pos. = predicted 1s actual 0s 27.500%
False neg. for predicted neg. = predicted 0s actual 1s 38.000%
False predictions = actual 1s and 0s incorrectly predicted 29.600%
=======================================================================
Phd in Transportation / Transport Demand Modelling 29/60
Binary model - example
Marginal effects - Probit Probit
;Lhs = dependent variable
;Rhs = One,independent variables (separated by commas)
;Marginal Effects$
+-------------------------------------------+
| Partial derivatives of E[y] = F[*] with |
| respect to the vector of characteristics. |
| They are computed at the means of the Xs. |
| Observations used for means are All Obs. |
+-------------------------------------------+
+--------+--------------+----------------+--------+--------+----------+
|Variable| Coefficient | Standard Error |b/St.Er.|P[|Z|>z]|Elasticity|
+--------+--------------+----------------+--------+--------+----------+
---------+Index function for probability
Constant| .78394066 .23700876 3.308 .0009
IDADE | .00292314 .00341333 .856 .3918 .18657108
---------+Marginal effect for dummy variable is P|1 - P|0.
SEXO | .14305236 .06199495 2.307 .0210 .09581501
FDIM | .09920747 .04529663 2.190 .0285 .43691129
DENS | -.21851069 .08370650 -2.610 .0090 -.14578635
---------+Marginal effect for dummy variable is P|1 - P|0.
DEFEST | -.16006850 .07732981 -2.070 .0385 -.05313173
NADUL | -.22486876 .05699234 -3.946 .0001 -.79839175
AIDM | -.00866935 .00451035 -1.922 .0546 -.55265870
---------+Marginal effect for dummy variable is P|1 - P|0.
EMP | -.09384027 .07591962 -1.236 .2164 -.09066443
Phd in Transportation / Transport Demand Modelling 30/60
Binary model - example
Marginal effects - Logit Logit
;Lhs = dependent variable
;Rhs = One,independent variables (separated by commas)
;Marginal Effects$
+-------------------------------------------+
| Partial derivatives of probabilities with |
| respect to the vector of characteristics. |
| They are computed at the means of the Xs. |
| Observations used are All Obs. |
+-------------------------------------------+
+--------+--------------+----------------+--------+--------+----------+
|Variable| Coefficient | Standard Error |b/St.Er.|P[|Z|>z]|Elasticity|
+--------+--------------+----------------+--------+--------+----------+
---------+Marginal effect for variable in probability
Constant| .78476651 .24198166 3.243 .0012
IDADE | .00289288 .00341363 .847 .3967 .18374445
---------+Marginal effect for dummy variable is P|1 - P|0.
SEXO | .14358532 .06248443 2.298 .0216 .09570572
FDIM | .09588839 .04613818 2.078 .0377 .42024662
DENS | -.21544998 .08474301 -2.542 .0110 -.14304739
---------+Marginal effect for dummy variable is P|1 - P|0.
DEFEST | -.16067168 .07877697 -2.040 .0414 -.05307338
NADUL | -.21984558 .05768361 -3.811 .0001 -.77677267
AIDM | -.00871365 .00451725 -1.929 .0537 -.55278958
---------+Marginal effect for dummy variable is P|1 - P|0.
EMP | -.09686083 .07636889 -1.268 .2047 -.09312906
Phd in Transportation / Transport Demand Modelling 31/60
Ordered and Multinomial models
multinomial discrete models does not account for the ordinal nature
of the discrete data and thus the ordering information is lost. If an
unordered model is used to model ordered data, the model
parameter estimates remain consistent but there is a loss of
efficiency.
Phd in Transportation / Transport Demand Modelling 32/60
Ordered Response Models
Ordered probability models are derived by defining an unobserved
variable, z. This unobserved (latent) variable is typically specified as
a linear function for each observation
Observed ordinal data, y, are defined as:
m are estimable parameters (thresholds)
that define y, and are estimated jointly
with the model parameters (b)
Phd in Transportation / Transport Demand Modelling 33/60
Ordered Response Models
Estimation problem: determining the probability of I specific
ordered responses for each observation. It is accomplished by
making an assumption on the distribution of e.
m0 is set to zero
mi is the upper threshold
mi-1 is the lower threshold
-
Phd in Transportation / Transport Demand Modelling 34/60
Ordered Response Models
The choice for a Ordered Logit or Ordered Probit depends largely on
the assumptions about the error term and is strongly related with the
convenience of use
Ordered Probit
Ordered Logit
Phd in Transportation / Transport Demand Modelling 35/60
Maximum Likelihood estimation
The likelihood function is
Where din is 1 if the observed discrete outcome for observation n is i,
(zero otherwise)
The log-likelihood is
The maximization of the LL fuction is subject to 0≤m1 ≤m2 ≤… ≤mI-2
Phd in Transportation / Transport Demand Modelling 36/60
Thresholds
IIf bX increases
Phd in Transportation / Transport Demand Modelling 37/60
Marginal Effects
Evaluating the effect of individual estimated parameters in ordered
probability models, might be misleading for the intermediate
thresholds
Depending on the location of the thresholds, it is not necessarily
clear what effect a positive or negative bk has on the probabilities of
these “interior” categories
Marginal effects provide the direction of the probability for each
category.
Phd in Transportation / Transport Demand Modelling 38/60
Marginal Effects
Marginal effects can be misleading:
When the probability curve changes rapidly
When and independent variable is a dummy variable
It could be substituted by Discrete Change:
Change in the predicted probability for a change in xk from the start
value xs to the end value xe
The value of discrete change depends on:
The values assumed for the variables that are not changing;
The value at which xk starts;
The amount of change in xk
Phd in Transportation / Transport Demand Modelling 39/60
Marginal Effects
For continuous variables the change in the probability could be
estimated for:
a unit change around the mean;
a standard deviation change centered on the mean
Change from minimum to maximum
It is possible to calculate the average absolute discrete change which
is relative to the effects of one variable across all of the outcome
categories.
Phd in Transportation / Transport Demand Modelling 40/60
Inference about the parameters
Inference about coefficients is based on the standard “z” test:
Inference about the threshold parameters would be meaningless,
and is not generally carried out (although NLogit presents it).
Phd in Transportation / Transport Demand Modelling 41/60
Wald test
When the objective is to test more than one coefficient
simultaneously the Wald test is used.
E.g. test if two coefficients are simultaneously equal to zero
The result is a chi squared statistic with degrees of freedom equal to
the number of restrictions.
Where R is a matrix of coefficients in the linear restrictions, q is a vector
of constants and V is the estimated asymptotic covariance matrix of the
coefficients
Phd in Transportation / Transport Demand Modelling 42/60
Likelihood ratio test
The likelihood ratio test is used to test if the model is a statistical
improvement over a base model (null or restricted model).
The test statistic is simply twice the difference between the log
likelihoods for the null and alternative models.
Is usually simpler than the Wald test. Asymptotically, the two
statistics have the same characteristics when the assumptions of the
model are met. But the two tests could conflict for a particular
significance level (LR is the preferred one)
Phd in Transportation / Transport Demand Modelling 43/60
Likelihood ratio test
The likelihood ratio test provides a more convenient approach for
testing homogeneity of strata in the data. E.g. if it makes sense to
build different models for both genders.
The statistic has a limiting chi squared distribution with degrees of
freedom equal to g-1 times the number of parameters in the model.
The null hypothesis states that the same ordered choice model
applies to both strata.
Phd in Transportation / Transport Demand Modelling 44/60
Fit measures
Pseudo R2
Adjusted Pseudo R2
M is the number of parameters in the model
Phd in Transportation / Transport Demand Modelling 45/60
Measures of fit based on predictions
nj* is the count of the most frequent outcome
Phd in Transportation / Transport Demand Modelling 46/60
Fit measures
Fit measures could be used to compare models to each other, not
only to baseline (null) models.
The following measures are not normalized to the unit interval, but
are based on the log likelihood function
M – number of parameters, n-sample size
They reward parsimony and small samples. A better model is one
with a smaller information criterion.
Phd in Transportation / Transport Demand Modelling 47/60
Parallel slopes assumption
Important assumption in an Ordered Model
This is the definition of a set of binary models with different intercepts
Phd in Transportation / Transport Demand Modelling 48/60
Parallel slopes assumption
Changing the intercepts only shifts the probability curves right or left
It doesn´t changes the slope
Phd in Transportation / Transport Demand Modelling 49/60
Parallel slopes assumption
One way to test the parallel slopes assumption is to use the Brant
test, which is formulated for ordered logit
The logit formulation implies the proportional odds assumption
This could be informally tested using i-1 binary models and compare
their coefficients
Phd in Transportation / Transport Demand Modelling 50/60
Brant test
The following hypothesis are tested
» or
The Wald statistic used is:
Where Asy.Var is the assymptotic Covariance matrix
is obtained by stacking the individual binary logit estimates of b
The Brant test could be calculated both the global model and for individual
coefficients
Phd in Transportation / Transport Demand Modelling 51/60
Example – Ordered Response Model
A survey made in Seattle tried to assess the opinion of drivers about
HOV lanes being opened to all users regardless of number of
occupants ( disagree strongly, disagree, neutral, agree, agree
strongly)
Build an ordered probit regressing this variable against the following:
Drive alone (1, 0 otherwise)
Flexible working time (1, 0 otherwise)
Commuter household income
Old age (1 is 50 years old or more, 0 otherwise)
Number of times in the past five commutes that changed route or
departure time
N= 322
Phd in Transportation / Transport Demand Modelling 52/60
Example – Ordered Response Model
Syntax using Nlogit/Limdep
ORDERED
;Lhs= y label
;Rhs=one,xlabels(separated by commas)$
Phd in Transportation / Transport Demand Modelling 53/60
Example – Ordered Response Model
+---------------------------------------------+
| Ordered Probability Model |
| Maximum Likelihood Estimates |
| Model estimated: Oct 26, 2010 at 11:24:32AM.|
| Dependent variable OPINION |
| Weighting variable None |
| Number of observations 322 |
| Iterations completed 14 |
| Log likelihood function -456.2479 |
| Number of parameters 9 |
| Info. Criterion: AIC = 2.88974 |
| Finite Sample: AIC = 2.89153 |
| Info. Criterion: BIC = 2.99524 |
| Info. Criterion:HQIC = 2.93186 |
| Restricted log likelihood -484.0105 |
| McFadden Pseudo R-squared .0573594 |
| Chi squared 55.52512 |
| Degrees of freedom 5 |
| Prob[ChiSqd > value] = .0000000 |
| Underlying probabilities based on Normal |
+---------------------------------------------+
Log Likelihood ratio
Pseudo Rho2
Phd in Transportation / Transport Demand Modelling 54/60
Example – Ordered Response Model
+---------------------------------------------+
| Ordered Probability Model |
| Cell frequencies for outcomes |
| Y Count Freq Y Count Freq Y Count Freq |
| 0 99 .307 1 85 .263 2 26 .080 |
| 3 36 .111 4 76 .236 |
+---------------------------------------------+
+--------+--------------+----------------+--------+--------+----------+
|Variable| Coefficient | Standard Error |b/St.Er.|P[|Z|>z]| Mean of X|
+--------+--------------+----------------+--------+--------+----------+
---------+Index function for probability
Constant| -.64741849 .20409362 -3.172 .0015
DALONE | 1.07608334 .15683714 6.861 .0000 .77018634
FLEXIBLE| .20336728 .12544314 1.621 .1050 .54037267
INCOME | .198148D-05 .139144D-05 1.424 .1544 75900.4876
OAGE | .24365556 .15049386 1.619 .1054 .20807453
CHANGE | .06698714 .05038731 1.329 .1837 .73913043
---------+Threshold parameters for index
Mu(1) | .76959111 .06536482 11.774 .0000
Mu(2) | .99994690 .07005703 14.273 .0000
Mu(3) | 1.35038329 .08101695 16.668 .0000
Thresholds
Z test for the coefficients
P-values
Phd in Transportation / Transport Demand Modelling 55/60
Example – Ordered Response Model
+---------------------------------------------------------------------------+
| Cross tabulation of predictions. Row is actual, column is predicted. |
| Model = Probit . Prediction is number of the most probable cell. |
+-------+-------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
| Actual|Row Sum| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
+-------+-------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
| 0| 99| 47| 34| 0| 0| 18|
| 1| 85| 18| 34| 0| 0| 33|
| 2| 26| 4| 8| 0| 0| 14|
| 3| 36| 3| 12| 0| 0| 21|
| 4| 76| 13| 24| 0| 0| 39|
+-------+-------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
|Col Sum| 322| 85| 112| 0| 0| 125| 0| 0| 0| 0| 0|
+-------+-------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
Phd in Transportation / Transport Demand Modelling 56/60
Example – Ordered Response Model
Display marginal effects ORDERED
;Lhs= y label
;Rhs=one,xlabels(separated by commas)
;Marginal Effects$
For the dummy variables the marginal effects don´t make sense. Discrete change should
estimated instead using excel.
+-------------------------------------------------------------------------+
| Summary of Marginal Effects for Ordered Probability Model (probit) |
+-------------------------------------------------------------------------+
Variable| Y=00 Y=01 Y=02 Y=03 Y=04 Y=05 Y=06 Y=07 |
--------------------------------------------------------------------------+
*DALONE -.3979 .0355 .0450 .0809 .2365
*FLEXIBL -.0703 -.0085 .0061 .0146 .0581
INCOME .0000 .0000 .0000 .0000 .0000
*OAGE -.0804 -.0154 .0058 .0160 .0740
CHANGE -.0231 -.0030 .0020 .0048 .0193
Phd in Transportation / Transport Demand Modelling 57/60
Example – Ordered Response Model
Brant test ORDERED
;Lhs= y label
;Rhs=one,xlabels(separated by commas)
;Brant test$
+------------------------------------------------+
| Brant specification test for equal coefficient |
| vectors in the ordered probit model. The model |
| implies that normit[Prob(y>j|x)]=mj - beta(j)*x|
| for all j = 0,..., 3. The chi squared test is |
| H0:beta(0) = beta(1) = ... beta( 3) |
| Chi squared test statistic = 13.74008 |
| Degrees of freedom = 15 |
| P value = .54533 |
+------------------------------------------------+
===========================================================================
Specification Tests for Individual Coefficients in Ordered Logit Model
(Note, Coefficients for values beyond y = 5 are not reported.)
Degrees of freedom for each of these tests is 3
===========================================================================
| Brant Test | Coefficients in implied model Prob(y > j). |
Variable| Chi-sq P value | 0 | 1 | 2 | 3 | 4 | 5 |
DALONE | 2.17 .53843 | 1.1814| 1.0059| .9745| .8310|
FLEXIBLE| 2.28 .51544 | .2276| .1178| .2419| .2443|
INCOME | 1.13 .76890 | .0000| .0000| .0000| .0000|
OAGE | 4.00 .26188 | .4150| .2768| .2385| -.0196|
CHANGE | 3.10 .37591 | .0904| .0853| .0272| .0644|
What can we conclude?
Phd in Transportation / Transport Demand Modelling 58/60
Example – Ordered Response Model
Wald test ORDERED
;Lhs= y label
;Rhs=one,xlabels(separated by commas)$
Wald
;fn1=b_dalone;fn2=b_income$
+-----------------------------------------------+
| WALD procedure. Estimates and standard errors |
| for nonlinear functions and joint test of |
| nonlinear restrictions. |
| Wald Statistic = 49.74881 |
| Prob. from Chi-squared[ 2] = .00000 |
+-----------------------------------------------+
+--------+--------------+----------------+--------+--------+
|Variable| Coefficient | Standard Error |b/St.Er.|P[|Z|>z]|
+--------+--------------+----------------+--------+--------+
Fncn(1) | 1.07608334 .15683714 6.861 .0000
Fncn(2) | .198148D-05 .139144D-05 1.424 .1544
What can we conclude?
Phd in Transportation / Transport Demand Modelling 59/60
Example – Ordered Response Model
Ordered Logit ORDERED
;Logit
;Lhs= y label
;Rhs=one,xlabels(separated by commas)$
+---------------------------------------------+
| Ordered Probability Model |
| Maximum Likelihood Estimates |
| Model estimated: Oct 26, 2010 at 11:59:45AM.|
| Dependent variable OPINION |
| Weighting variable None |
| Number of observations 322 |
| Iterations completed 11 |
| Log likelihood function -458.6460 |
| Number of parameters 6 |
| Info. Criterion: AIC = 2.88600 |
| Finite Sample: AIC = 2.88683 |
| Info. Criterion: BIC = 2.95633 |
| Info. Criterion:HQIC = 2.91408 |
| Restricted log likelihood -484.0105 |
| McFadden Pseudo R-squared .0524047 |
| Chi squared 50.72882 |
| Degrees of freedom 2 |
| Prob[ChiSqd > value] = .0000000 |
| Underlying probabilities based on Logistic |
+---------------------------------------------+
+---------------------------------------------+
| Ordered Probability Model |
| Maximum Likelihood Estimates |
| Model estimated: Oct 26, 2010 at 11:59:45AM.|
| Dependent variable OPINION |
| Weighting variable None |
| Number of observations 322 |
| Iterations completed 10 |
| Log likelihood function -459.1389 |
| Number of parameters 6 |
| Info. Criterion: AIC = 2.88906 |
| Finite Sample: AIC = 2.88989 |
| Info. Criterion: BIC = 2.95940 |
| Info. Criterion:HQIC = 2.91714 |
| Restricted log likelihood -484.0105 |
| McFadden Pseudo R-squared .0513863 |
| Chi squared 49.74300 |
| Degrees of freedom 2 |
| Prob[ChiSqd > value] = .0000000 |
| Underlying probabilities based on Normal |
+---------------------------------------------+
Ordered Logit Ordered Probit
Phd in Transportation / Transport Demand Modelling 60/60
Example – Ordered Response Model
+--------+--------------+----------------+--------+--------+----------+
|Variable| Coefficient | Standard Error |b/St.Er.|P[|Z|>z]| Mean of X|
+--------+--------------+----------------+--------+--------+----------+
---------+Index function for probability
Constant| -.68463225 .27072789 -2.529 .0114
DALONE | 1.83872892 .26601268 6.912 .0000 .77018634
FLEXIBLE| .27397570 .20566894 1.332 .1828 .54037267
---------+Threshold parameters for index
Mu(1) | 1.25747687 .10533638 11.938 .0000
Mu(2) | 1.62939558 .11316012 14.399 .0000
Mu(3) | 2.21141414 .13503295 16.377 .0000
+--------+--------------+----------------+--------+--------+----------+
|Variable| Coefficient | Standard Error |b/St.Er.|P[|Z|>z]| Mean of X|
+--------+--------------+----------------+--------+--------+----------+
---------+Index function for probability
Constant| -.38909587 .15856689 -2.454 .0141
DALONE | 1.08069300 .15572418 6.940 .0000 .77018634
FLEXIBLE| .17114231 .12347051 1.386 .1657 .54037267
---------+Threshold parameters for index
Mu(1) | .75749605 .06465232 11.716 .0000
Mu(2) | .98507310 .06944107 14.186 .0000
Mu(3) | 1.33379198 .08050137 16.569 .0000
Ordered Logit
Ordered Probit
Phd in Transportation / Transport Demand Modelling 61/60
Recommended readings
Washington, Simon P., Karlaftis, Mathew G. e Mannering (2003)
Statistical and econometric Methods for Transportation Data
Analysis, CRC
Greene, William and Hensher, David A. (2010) Modelling Ordered
Choice. A primer, Cambridge University Press
Long, J. Scott (1997) Regression Models for categorical and limited
dependent variables, Sage