Chapter 1.2
Chapter 1.2 Linear Models 2
A linear function is a function which graphs as a straight line. A linear function has the
characteristic that
• for every unit change in the input function,
• the output function changes by a constant amount.
Example:
The Philadelphia Gas Works, PGW, provides natural gas to homes and businesses in the Philadelphia metro area.
This example deals with
residential gas usage and costs. Residences are charged
Chapter 1.2 Linear Models 4
PGW charges each residential customer a flat fee of $15
monthly.
In addition, residential customers pay $0.45 per each cubic feet
This relationship is characterized by the following:
• for every unit change in the input variable (usage increases by 1 ft3),
• the output variable changes by a constant amount (cost increases by ).
Chapter 1.2 Linear Models 6
Since every unit change in the input variable (gas usage)
produces a constant change in the output variable (cost), the
relationship between usage and cost can be modeled as a linear function.
That is, a linear model can be used to describe the relationship between the two variables.
If f(x) is a linear function of an input variable, x, then a linear model
relating them is given by:
�
(
�
)
=
� �
+
�
where:
• a represents the slope of the line, and • b is the vertical axis intercept
Chapter 1.2 Linear Models 8
A linear function has a constant rate of change which is equal to the
numerical value of the slope parameter.
�
(
�
)
=
� �
+
�
The quantities a and b in the model
gas use (ft3) cost ($)
0 15.00
100 60.00
200 105.00
300 150.00
400 195.00
Returning to the gas usage example, the data can be expressed numerically as:
01p32a Chapter 1.2 Linear Models 10
How might we find an algebraic
expression for the linear relationship? The slope is calculated by dividing the
rise by the run, being careful regarding signs:
• The rise is the change in output
value (vertical scale of graph) as we move from Point 1 to Point 2.
Chapter 1.2 Linear Models 12
�����= �
(
�2)
− �(
�1)
�2 − �1
When x is the input and f(x) is the output:
In our example
• g, gas use, is the input and
• C(g), cost as a function of gas use, is the output
�����= �
(
�2)
− �(
�1)
�2− �1
Arbitrarily selecting two ordered pairs from the table:
(100, 60)
(400, 195)
ris
e
=
$
13
5
Chapter 1.2 Linear Models 14
The order of assigning (g1, C(g1)) and (g2, C(g2)) is irrelevant as
long as we properly use the slope formula.
�����= �
(
�2)
− �(
�1)
�2− �1
Assigning: (g1, C(g1)) = (100, 60)
(g2, C(g2)) = (400, 195)
�����= 195−60
400−100
$
��3
�����=135
300 =
$ 0.45
��3
�����= �(�2)−�( �1)
�2−�1
Chapter 1.2 Linear Models 16
Assigning: (g1, C(g1)) = (400, 195)
(g2, C(g2)) = (100, 60)
�����= 60−195
100 − 400
$ ��3
�����=−135
−300=
$0.45
��3
�����= �(�2)−�( �1)
�2−�1
Note, the vertical axis intercept, b, is 15. That is, the ordered
Chapter 1.2 Linear Models 18
a
=
slope
=
$
0.45
��
3
b
=
verticalaxisintercept
=
$
15
�
(
�
)
=
0 .45
�
+
15
Algebraically:
where:
• g is gas usage (ft3)
• C is cost ($)
The constant rate of change is the slope value of .
Chapter 1.2 Linear Models 20
The function in the last example had a positive slope. Note that the line rose from left to right. That is, as the input changes by a positive value, so does the
In general, lines with:
• positive slopes rise from left to right, • negative slopes fall from left to right, • zero slope are horizontal, and
• no slope (undefined) are vertical and are not functions since they fail the
Chapter 1.2 Linear Models 22
h(x) has a positive slope: • h(x) rises from left to
right, •
•
lim
� −
h ( � )=−
lim
� +
h ( � )=+
r(t) has a negative slope: • r(t) falls from left to
right, • • lim � − � ( � )=+ lim � + � (� )=−
Chapter 1.2 Linear Models 24
This function has a zero slope: The function is
horizontal and has a constant value equal to the vertical axis intercept, b.
This graph has no slope: The graph is vertical
and has an equation of the form x = c,
where x is the input variable, and c is a constant.
Chapter 1.2 Linear Models 26
A word about units:
Any equation must be
dimensionally consistent.
That is, each term in the
equation must be in the same units.
Returning to the gas cost example:
�
(
�
)
=
0 .45
�
+
15
where:
• g in units of ft3
Chapter 1.2 Linear Models 28
Since g is in ft3, then the slope, , must be in
units of . This is consistent with the definition of slope as . When we calculate slope, we
include the units.
Since C is in units of $, then each
term on the right side must be in units of $.
�
(
�
)
=
0 .45
�
+
15
A model is an equation describing the relationship between input and output data. A well-defined model requires: 1. a mathematical equation
2. a well-described input variable, complete with units,
3. a well-described output variable, complete with units, and
01p36a Chapter 1.2 Linear Models 30
Example:
where
• t is the time, in years, since
purchase, and • r(t) is the resale
value in dollars r(t) is the resale value of a truck
Identify the point at which the input is 0. Interpret.
01p36a Chapter 1.2 Linear Models 32
Identify the point at which the input is 0. Interpret.
When the input
value, t, is 0, r(t) is 12,000. This is the value of a new
Identify the point at which the output is 0. Interpret.
01p36a Chapter 1.2 Linear Models 34
Identify the point at which the output is 0. Interpret.
When the output value, r(t), is 0, t is 8. The truck has no resale value after 8 years.
Identify the vertical axis intercept, b.
01p36a Chapter 1.2 Linear Models 36
Identify the vertical axis intercept, b.
Graphically, the vertical axis
intercept, b, is 12,000.
01p36a Chapter 1.2 Linear Models 38
Identify the slope, a.
(0, 12000), and (8, 0)
Graphically, we know two
Identify the slope, a. Assigning:
(t1, r(t1)) = (8,0)
01p36a Chapter 1.2 Linear Models 40
Identify the slope, a.
�����=�
(
�1)
−�(
�2)
�1 −�2
�����
=
0
−
12000
8
−
0
The negative slope indicates the truck
depreciates at the constant rate of $1500 per year.
01p36a Chapter 1.2 Linear Models 42
Note that the slope units are output units
divided by input units.
Write the linear
model associated with these data.
The model is:
�
(
�
)
=
��
+
�
where:
�
(
�
)
=
−
1500
�
+
12000
01p36a Chapter 1.2 Linear Models 44
Write the linear
model associated with these data.
The model is:
0 t 8
Note that every term in the model has units of $.
Often we are interested in building
models based upon real-world data. A linear model is only considered when a scatterplot of the data indicates the data may be linear.
Consider the following data, available from the US Department of Energy,
relating to Retail Sales of Electricity in the years 2003 through 2008.
Chapter 1.2 Linear Models 46
year retail electricity
sales
(quadrillion kWh)
2003 1.20
2004 1.23
2005 1.27
2006 1.30
2007 1.33
A scatterplot of the data indicates they may be linear.
Chapter 1.2 Linear Models 48
In this course we will be spending a
significant amount of time modeling real-world data. Modeling is the process of fitting a mathematical equation, or
model, to a data set.
Let’s see how we can use the TI-84
calculator to generate a linear model for the electricity data.
The TI-84 calculator has the ability to display a statistical quantity known as
the coefficient of determination, or R2 .
This quantity provides a quantitative
measure of the quality of fit of a model to the data being modeled.
0 ≤ R2 ≤ 1
Chapter 1.2 Linear Models 50
The TI-84 can show R2 values for the
following models which we will be using: • linear
• quadratic • cubic
• exponential • natural-log
It does not display it for the following models
• logistic • sine
To enable printing the R2 value for a
model:
• Select CATALOG (2nd 0), and scroll
down to DIAGNOSTIC ON. • Select ENTER
• Select ENTER again and you should see DONE.
Chapter 1.2 Linear Models 52
We are now ready to enter the data.
Selecting the STAT key provides options for entering data in Lists.
Select STAT then EDIT then Edit.
You should see the Lists as shown at right.
If there are data in L1 and/or L2, use the cursor to highlight the list name
(example, L1). Then select CLEAR ENTER to clear the lists.
NOTE: Do NOT use DEL as the delete
Chapter 1.2 Linear Models 54
The data appear linear. A linear model is therefore appropriate.
We wish to generate a linear model for the data and save the model as a Y
variable. See that the Y variable where you want to save the model is clear.
Chapter 1.2 Linear Models 56
Select a Linear Model by selecting
STAT, CALC, and then LinReg(ax+b).
Depending upon your specific calculator model, your next screen may be one of the following:
1. You may get a screen which includes: Store RegEQ. If so, scroll down next to Store RegEQ and select VARS , Y-VARS, Function, and Y1, or any other Yi where you want to save the equation. Select CALCULATE to execute the command.
2. Or your screen may show a blinking cursor. If so, the calculator is waiting for you to enter a Y variable in which to save the linear model. If you hit ENTER without
supplying a Y variable, the regression parameters will be provided but the equation not saved. Select ENTER to execute the command.
Chapter 1.2 Linear Models 58 Select ZOOM, ZoomStat, to graph both the scatterplot and the
The best-fitting model:
�
1(
�
)
0 .031
�
−
60.604
The symbol “” in the equation indicates the coefficients have been rounded for display purposes.
�
2
0 .992
01p39b Chapter 1.2 Linear Models 60
Here the linear model is graphed over the data scatterplot.
Recall that a linear model has a constant rate of change which is equal to the slope. The slope for the model is 0.031. Thus:
• for every unit increase in the input variable, in this case, one year,
• the increase in the output variable, quadrillion kWh sold, is a constant 0.031.
• That is, the rate of change is a constant
Chapter 1.2 Linear Models 62
So, for example, over any two year period between 2003 and 2008, the
average electricity sales increased by:
(
2
��
)
(
.031
�����������
��
h
��
)
=
0.062
�����������
��
h
Or, over any three month period
between 2003 and 2008, the average electricity sales increased by:
(
1
4
��
)(
.031
�����������
��
h
��
)
=
0.0082
�����������
��
h
Chapter 1.2 Linear Models 64
Note this model is based upon data for the period 2003 through 2008.
Using a model to estimate an output
value for an input value within the input interval over which the model is built is called interpolation.
Using a model to estimate an output
value for an input value outside the input interval over which the model is built is called extrapolation.
Using the electricity sales model, what were the expected sales at the end of 2005?
Since the model is based upon data from 2003 through 2008, this is an
interpolation.
�
1(
2005
)
(
.031
) (
2005
)
−
60.604
�
1(
�
)
0 .031
�
−
60.604
Chapter 1.2 Linear Models 66
Using the electricity sales model, what were the expected sales at the end of 2010?
Since the model is based upon data from 2003 through 2008, this is an
extrapolation.
�
1(
�
)
0 .031
�
−
60.604
�
1(
2010
)
(
.031
) (
2010
)
−
60.604
�
1(
2010
)
1.42
Note that extrapolation calculations
assume the pattern exhibited during the interval of the input data will continue
outside that interval. This is a
Chapter 1.2 Linear Models 68
When the input to a model is in years, it is often advantageous to renumber the input to reduce the magnitude of the
coefficients in the model. This is a process called data alignment.
Reconsider the electricity sales data if we select the end of the year 2000 to align with an input value of 0.
year new
input sales (quad kWh)
2003 3 1.20
2004 4 1.23
2005 5 1.27
2006 6 1.30
2007 7 1.33
Chapter 1.2 Linear Models 70
Using the TI-84 the new best-fitting model is:
�
2(
�
)
0 .031
�
+
1.110
�
1(
�
)
0 .031
�
−
60.604
Recall the model for the raw (non-aligned) input data:
We now re-ask: What were the expected sales at the end of 2005?
Since 0 is aligned with the end of the year 2000, then the end of 2005 is
aligned with the new input of 5.
�
2(
5
)
(
.031
) (
5
)
+
1.110
�
2(
5
)
1.26
�
2(
�
)
0 .031
�
+
1.110
Chapter 1.2 Linear Models 72
Numerical considerations in reporting and calculating results:
• When fitting a function to data, the TI-84 calculates model coefficients to a large number of decimal digits. We can round coefficient results for
display purposes but using rounded coefficients to perform calculations may result in gross inaccuracies.
Numerical considerations in reporting and calculating results (cont):
• Numerical modeling output should be rounded to the same accuracy as the output data used to create the model. For example, if output units used to
create the model have two decimal digits, then report model results with two decimal digits.
Chapter 1.2 Linear Models 74
Numerical considerations in reporting and calculating results (cont):
• When performing a series of
operations, only round the final result, not intermediate results.