Mathematical Modeling Making Predictions with Data Introduction to Engineering Design © 2012 Project Lead The Way, Inc. Function A rule that takes an input, transforms it, and produces a unique output t d • Can be represented by 2 3 5 8 10 • Domain – the set of inputs t ≥ 0 • Range – the set of outputs d ≥3 Distance, d (ft) – a table that maps an input to an output – a graph – an equation involving two variables 13 18 28 43 53 50 y = 5t + 3 40 30 20 10 0 0 1 2 3 4 5 6 7 time, t (s) 8 9 10 Linear Function A function that demonstrates a constant rate of change between two quantities • Can be represented by a line on a coordinate grid • Can be represented by a linear equation involving two variables Distance traveled over time Cost based on number of items purchased 50 40 Cost ($) • Can represent real-life situations 60 y = 4.5 x 30 20 10 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 Number of items, n Linear Equation A linear function can be expressed by a linear equation • An equation involving two variables Independent variable, x Horizontal axis Vertical axis • Variables can represent any two related quantities 90 y 80 100 70 80 60 50 60 40 40 30 20 20 10 0 0 0 0 Distance Distance, d (ft) Dependent variable, y y = 5x + 3 5 5 Time, t (s) 10 10 15 15 x Linear Equation d 2 3 5 8 10 t 13 18 28 43 53 (5, 28) 30 time, t (s) • Data is often collected in tables • Data is graphed on a coordinate plane as ordered pairs 25 (3, 18) 20 (2, 13) 15 10 5 0 0 1 2 3 4 Distance, d (ft) 5 6 Linear Equation • A line can be drawn through data points – Line-of-best-fit – Trendline y = mx + b Rise 5 m = slope = = 1= Run b = y-intercept = Distance, d (ft) • Slope-intercept form 30 25 y = 5x 5 +3 20 15 1 5 10 5 0 0 1 2 3 Time, t (s) 4 5 6 Function Notation • Functions are often denoted by letters such as F, f, G, w, V, etc. • G(t) represents the output value of G at the input number t Garbage production over time t is a member of the Domain Garbage Production Garbage Produced per day (tons) t≥0 G(t) is a member of the Range G(t) ≥ 427.92 tons slope m = 20.05 tons/year Garbage production increases by 20.05 tons/year 1200 1000 G(t) = 20.051t + 427.92 800 600 400 200 0 0 10 20 30 Year (t=0 represents 1970) 40 Function Notation • Example: d(t) = 5t +3 Slope, m = 5 ft/s The toy car moves 5 feet for every second of time y-intercept, b = 3 ft The toy car is initially 3 feet from the line at time t = 0 When will the object be 23 feet from the line? d(t) = 23 = 5t +3, t=4 distance, d (ft) What is the distance at t = 6 s d(6) = 5 · (6) + 3 = 33 ft 50 40 y = 5x + 3 33 30 20 10 0 0 1 2 3 4 4 5 time, t (s) 6 7 8 9 10 Correlation Coefficient, r • Measure of strength of a linear relation -1 ≤ r ≤ 1 r = ±1 is a perfect correlation r = 0 indicates no correlation • Positive r indicates a direct relationship As one variable increases, so does the other • Negative r indicates an inverse relationship As one variable increases, the other decreases • Strength of relationship r > 0.8 is a strong correlation r < 0.5 is a weak correlation Coefficient of Determination, r2 • Measure of how well the line represents the data 0 ≤ r2 ≤ 1 • Portion of the variance of one variable that is predictable from the other Example: r2 = 0.65, 65% of variation in y is due to x. The other 35% is due to other variable(s). • Square of the Correlation Coefficient Finding Trendlines with Excel • Create table of data • Common practice to re-label years starting with n = 1 • Select data Sales Fiscal Year Year Sales Fiscal Year 2003 = 1 (millions (millions$) $) 2003 2004 2005 2006 2007 2008 2009 2010 2011 03 1 04 2 2.35 2.35 2.22 2.22 05 3 06 4 07 5 08 6 09 7 10 8 11 9 2.34 2.34 2.54 2.54 2.55 2.55 2.75 2.75 3.11 3.11 3.24 3.24 3.15 3.15 Finding Trendlines with Excel • Insert Scatterplot Finding Trendlines with Excel • Format the Scatterplot • Select the scatterplot • Choose the Layout tab • Chart Title • Axis Titles • Gridlines • Legend (delete) Finding Trendlines with Excel • Format the Scatterplot • Select the scatterplot • Under Chart Tools • Choose Format tab • Select Horizontal (Value) Axis in drop down menu • Choose Format selection • Adjust the axis options • Select Vertical (Value) Axis • Choose Format selection • Adjust the axis options Note that the horizontal axis was formatted to show several years in the future. Finding Trendlines with Excel • Add Trendline • Select the scatterplot • Under Chart Tools • Choose Layout tab • In the Analysis panel • Choose Linear Trendline • Select Trendline (either within chart or in Current Selection panel) • Forecast • Display Equation • Display R-squared value Making Predictions • Use the trendline to make predictions – Function notation S(t) = 0.1335t+2.0269 where S(t) = projected sales t = year number (t = calendar year - 2002) Sales (million $) Sales Forecast 5 4,5 4 3,5 3 2,5 2 1,5 1 0,5 0 S(t) = 0.1335t + 2.0269 R² = 0.8948 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Year, t (where t = 0 represents 2002) Making Predictions • Use the trendline to make predictions – What is the sales projection for 2015? t = 2015 – 2002 = 13 S(13) = 0.1335(13)+2.0269 = $3.76 million 5 4,5 4 3,5 3 2,5 2 1,5 1 0,5 0 r2 = 0.89 r = 0.89 = 0.94 S(t) = 0.1335t + 2.0269 R² = 0.8948 2015 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Year, t (where t = 0 represents 2002) 2003 Sales (million $) Sales Forecast Making Predictions • Use the trendline to make predictions S(t) = 0.1335t + 2.0269 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Year, t (where t = 0 represents 2002) 017 Calendar year = 2017 5 4,5 4 3,5 3 2,5 2 1,5 1 0,5 0 2002 2003 t = calendar year – 2002 15 = calendar year – 2002 Calendar year = 15 + 2002 Sales (million $) – When will the sales reach $4 million? S(t) = 0.1335t+ 2.0269 4 = 0.1335t + 2.0269 1.9731 0.1335t = 4 – 2.0269 Sales Forecast 1.9731 t= = 14.8 0.1335 Say t = 15