Week 05: Trip Generation (Regression Models – Part 02)
CEE 6505: Transportation Planning
Department of Civil and Environmental Engineering
Islamic University of Technology (IUT), Bangladesh
Content
• Hypothesis testing: single linear hypothesis (the
‘t’ test)
• Advanced empirical specifications:
nonlinearities and market segmentation
• Hypothesis testing: multiple linear hypotheses
(the ‘F’ test)
• Forecasting
• Balancing Production and Attraction
Hypothesis Testing (1) – the “t” test
Population or “True” Equation
NOTE: By influence we really mean correlation, i.e., the correct question is
“is household size correlated with Number of Trips”–will address this issue
3
in detail later on
Hypothesis Testing (1) –The “t” test
Given a sample, we can determine a point estimate and confidence
intervals for the population parameter
What can we say about whether the true parameter is zero or not based on an
estimate and its standard error? 4
Hypothesis Testing (1) – the “t” test
5
Hypothesis Testing (1) – the “t” test
6
Hypothesis Testing (1) – the “t” test
7
Hypothesis Testing (1) – the “t” test
8
Hypothesis Testing (1) – the “t” test
model output diye
formulate korte bolte pare
need to write equation diye hypothesis
professionally like this gula likhte bolte pare
9
Hypothesis Testing (1) – the “t” test
same jinis e 2 vabe
Numcars and HHSize likhse
same for both case
10
Hypothesis Testing (1) – the “t” test
11
Goodness of Fit
• How do we determine how well any model is “explaining” the
R-squared
trip-making behavior of households?
• How do we compare two different models with different
explanatory factors estimated using the same data set?
12
Goodness of Fit
when we calculate R^2, it's only
comparing our model against a model
that's just an average value (naive
model). Based on the R^2 value, we
explanatory variables cannnot say that our model is the best
, but we can say whether our model is
better than simply averaging the data
or not.
our model
naive model
13
Model with Explanatory Variables: Residuals
our model residuals
14
Model with Explanatory Variables: Residuals
naive model residuals
15
observed datapoint
from survey i.e.,
Goodness of Fit Measure ground truth our model predicted
data point
alternate interpretation: Error_our_model
naive model
prediction (just the
mean value)
alternate interpretation: error_naive_model
alternate interpretation: our_model vs. naive_model
how well did
our_model do against
naive_model?
How well did the
naive_model do? 16
Goodness of Fit Measure
our model
perfectly
predicts every
data point
our model is
no better than
means our model the naive
performed the same model
as naive model, so
they negated each
other out
17
Goodness of Fit Measure
SST=SSR+SSE
SSR
SST 18
Comparing Models Using R2 Values
ONLY USE R^2 to compare between
different model if they have THE
SAME NUMBER OF PARAMETERS!
All these models have three
parameters each, so they can be
compared
19
Comparing Models Using R2 Values
FOR DIFFERENT
NUMBER OF
PARAMETERS, USE adj-
R^2
number(beta_1,
beta_2, ...) beta_0=intercept
which is why we need adj-R^2 20
to make a fair comparison
Overfitting, meaning our
model will perfectly fit for the
data that it was trained on,
Comparing Models Using R2 Values but will shit the bed when it
sees new data i.e., it will not
generalize well (common
problem in ML)
• R2 value is not an absolute
measure of how good a model
is – the most appropriate use
for R2 value is for comparing
models
• High R2 values can be because
of data artifacts. For example,
when number of parameters
estimated (K+1) is comparable
to the sample size (N) we can
get high R2 values 21
Advanced Empirical Specifications
• Nonlinearities
• Market Segmentation
• Hypothesis Testing(2) –The “F” test
22
Nonlinearities
23
Dummy Variable Formulation
24
Dummy Variable Formulation
trips made by a 0-car how much trips
HH increase when a HH
gets 1 car from 0
car...
25
Dummy Increment Formulation
26
Dummy Increment Formulation
when MCar2 is
activated, MCar1 is
also activated
because cars>=1
condition is fulfilled
it is the increment
from b_1, hence
called DUMMY
INCREMENT
27
Spline Formulation
breakpoint/knot,
meaning after 1 car,
the slope will change
28
Spline Formulation
the slope becomes flatter because c2=
-ve, which implies that #trips don't
increase as fast as it did before
(having 1 car)
29
Spline Formulation
30
Nonlinearities
all these represents
slopes.
Which one we'll use
depends on how we
want to train our
models.
31
Nonlinearities
32
Nonlinearities
33
Nonlinearities
flat lines because
dummy variables
disconnected
because if one
variable is activated
(=1), the others get
deactivated (=0).
34
Nonlinearities
non-linear because
squared
35
Nonlinearities
nonlinear because
logN
36
we do this to capture how the
Market Segmentation
variables interact with each other,
e.g., how being a male and having
children affect trip rates compared to
not being male
the difference is
always beta_1,
meaning there is no
impact of gender on
trips whether they
have children or not
37
Market Segmentation
38
Market Segmentation
this is
segmentation
interaction term
now we are seeing an
extra difference
compared to before
39
Market Segmentation
40
Market Segmentation
whether using a more
complex, segmented model is
useful or not
means there is no impact of
gender and having children
on the trip rates. The
segmented model is useless.
41
Market Segmentation
no interaction
between gender and
children
42
Market Segmentation
gender has no impact
on non-work trips
43
Market Segmentation
44
Market Segmentation
unsegmented
45
Market Segmentation
46
Market Segmentation
here, child is the
segmenting
variable. We are
trying to see how
having a child
impacts employed
male's trip rates.
47
Market Segmentation
we have three
variables:
employment, gender
and children. We are
using children as the
anchor point and
checking how it
interacts with
employment and
gender. So this is fully
segmented.
48
Market Segmentation
gender has no impact
ei part ashbei.
Equation diye hypothesis
gula likhte bolbe.
employment has no Or beta_5=0 or !=0 hoile ki
impact imply kore likhte hobe.
49
Market Segmentation
because employment
er impact nai
50
Market Segmentation
51
Market Segmentation
52
Empirical Specifications TO-DO
MATH
(2) Nonlinear unsegmented model
(Dummy Variable formulation)
53
Empirical Specifications
54
Empirical Specifications
55
Empirical Specifications
erokom table banaite
bolte pare but he didn't
explain shit
56
Hypothesis Testing (2): The “F” Test
aka baka non0linear
model ke tene
straight kortesi
these conditions are 57
important for exams
Hypothesis Testing (2): The “F” Test
will also have to draw
these graphs
(qualitative)
2a_1-a_1=a_1 =
same slope = linear
58
Hypothesis Testing (2): The “F” Test
59
Hypothesis Testing (2): The “F” Test
60
Hypothesis Testing (2): The “F” Test
61
Hypothesis Testing (2): The “F” Test
62
Hypothesis Testing (2): The “F” Test
just zero out the
interaction terms
63
Hypothesis Testing (2): The “F” Test
linear
64
Hypothesis Testing (2): The “F” Test
including beta_0
number of restriction
conditions
65
Hypothesis Testing (2): The “F” Test
Restrictions are necessary =
linear model is better
non-linear model is
better
66
Hypothesis Testing (2): The “F” Test
67
Hypothesis Testing (2): The “F” Test
non-linear
linear model is better 68
Hypothesis Testing (2): The “F” Test
calculation check
69
Residuals
70
Hypothesis Testing (2): The “F” Test
Memorize.
approximate decision
71
Hypothesis Testing (2): The “F” Test
72
Hypothesis Testing (2): The “F” Test
73
Forecasting Trip Generation
eita mone rakhlei
hobe
74
Forecasting Trip Generation
75
Forecasting Trip Generation
76
Forecasting Trip Generation
77
Forecasting Trip Generation
TO-DO
MATH
78
Models for Attraction
79
Application Example and Trip Balancing
80
Application Example and Trip Balancing
81
Application Example and Trip Balancing
82
Application Example and Trip Balancing
83
Thank You!
• Contact me
– Email: moinul@[Link]