Transcript Linear Functions and Modeling
Linear Functions and Modeling
Week 1 LSP 120 Joanna Deszcz
What is a function?
Relationship between 2 variables or quantities Has a domain and a range Domain – all logical input values Range – output values that correspond to domain Can be represented by table, graph or equation Satisfies the vertical line test: If any vertical line intersects a graph in more than one point, then the graph does not represent a function.
What is a linear function?
Straight line represented by y=mx + b Constant rate of change (or slope) For a fixed change in one variable, there is a fixed change in the other variable Formulas Slope = Rise Run Rate of Change = Change in y Change in x
Linear Function
QR Definition: relationship that has a fixed or constant rate of change
Data
x
3 5 7 9 11
y
11 16 21 26 31 Does this data represent a linear function?
We’ll use Excel to figure this out
Rate of Change Formula
(y2- y1) (x2-x1)
Example: (16-11) = 5 ( 5-3) 2
x
3 5 7 9 11
y
11 16 21 26 31
In Excel
Input (or copy) the data In adjacent cell begin calculation by typing = Use cell references in the formula Cell reference = column letter, row number (A1, B3, C5, etc.) 5 6 1 2 3 4 A x 3 5 7 9 11 B y 11 16 21 26 31 C Rate of Change =(B3-B2)/(A3-A2)
Is the function Linear?
If the rate of change is constant (the same) between data points The function is linear
Derive the Linear Equation
General Equation for a linear function
y = mx + b
x and y are variables represented by data point values m is slope or rate of change b is y-intercept (or initial value) Initial value is the value of y when x = 0 May need to calculate initial value if x = 0 is not a data point
1 2 3 4 5 6
Calculating Initial Value (b variable)
A x 3 5 7 9 11 B y 11 16 21 26 31 C Rate of Change 2.5
2.5
2.5
2.5
So the linear equation for this data is: Choose one set of x and y values We’ll use 3 and 11 Rate of change = m m=2.5
Plug values into y=mx+b and solve for b 11=2.5(3) + b 11=7.5 + b 3.5=b y= 2.5x + 3.5
Practice – Which functions are linear x 5 10 15 20 y -4 -1 2 5 x 1 2 5 7 y 1 3 9 13 x 2 7 9 12 y 1 5 11 17 x 2 4 6 8 y 20 13 6 -1
Graph the Line
Select all the data points Insert an xy scatter plot Data points should line up if the equation is linear 35 30 25 20 15 10 5 0 0
Linear graph
y = 2.5x + 3.5
R² = 1 5
X - values
10 15
Be Careful!!!
t 1980 1981 1982 1983 1984 1985 1986 P 67.38
69.13
70.93
72.77
74.67
76.61
78.60
Not all graphs that look like lines represent linear functions! Calculate the rate of change to be sure it’s constant.
80 78 76 74 72 70 68 66 1975 1980 1985
t value
1990 t=year; P=population of Mexico
Try this data
t 1980 1990 2000 2010 2020 2030 2040 P 67.38
87.10
112.58
145.53
188.12
243.16
314.32
Does the line still appear straight?
Exponential Models
Previous examples show exponential data It can appear to be linear depending on how many data points are graphed Only way to determine if a data set is linear is to calculate rate of change Will be discussed in more detail later
Mathematical Modeling
Linear Modeling and Trendlines
Uses of Mathematical Modeling
Need to plan, predict, explore relationships Examples Plan for next class Businesses, schools, organizations plan for future Science – predict quantities based on known values Discover relationships between variables
What is a mathematical model?
Equation Graph or Algorithm that fits some real data reasonably well that can be used to make predictions
Predictions
2 types of predictions
Extrapolations
predictions outside the range of existing data
Interpolations
predictions made in between existing data points Usually can predict x given y and vise versa
Extrapolations
Be Careful The further you go from the actual data, the less confident you become about your predictions.
A prediction very far out from the data may end up being correct, but even so we have to hold back our confidence because we don't know if the model will apply at points far into the future .
Let’s Try Some
Cell phones.xls
MileRecords.xls
Is the trendline a good fit?
5 Prediction Guidelines Guideline 1 ▪ ▪ ▪ ▪ ▪ ▪ Do you have at least 7 data points? Should use at least 7 for all class examples more is okay unless point(s) fails another guideline 5 or 6 is a judgment call How reliable is the source?
How old is the data?
Practical knowledge on the topic
Guideline 2
Does the R-squared value indicate a relationship? Standard measure of how well a line fits
R2
=1 =0 Between .7 and 1.0
Between .4 and .7
< .4
Relationship
perfect match between line and data points no relationship between x and y values strong relationship; data can be used to make prediction moderate relationship; most likely okay to make prediction weak relationship; cannot use data to make prediction
Guideline 3
Verify that your trendline fits the shape of your graph.
Example: trendline continues upward, but the data makes a downward turn during the last few years verify that the “higher” prediction makes sense See Practical Knowledge
Guideline 4
Look for Outliers Often bad data points Entered incorrectly Should be corrected Sometimes data is correct Anomaly occurred Can be removed from data if justified
Average July Tempurature Chicago 2000-2010
100 90 80 70 60 50 40 30 20 10 0 1998 2000 2002 2004 2006 2008 2010 2012
Guideline 5
Practical Knowledge How many years out can we predict? Based on what you know about the topic, does it make sense to go ahead with the prediction? Use your subject knowledge, not your mathematical knowledge to address this guideline