![Page 1: Supplement: Curve Fitting aka . . . Choosing the appropriate model to fit the data](https://reader035.vdocument.in/reader035/viewer/2022062816/568161e2550346895dd1fa0b/html5/thumbnails/1.jpg)
Supplement: Curve Fittingaka . . . Choosing the appropriate model to fit the data
Linear
Quadratic
Cubic
Quartic
𝑦=𝑎𝑥+𝑏
𝑦=𝑎𝑥2+𝑏𝑥+𝑐
𝑦=𝑎𝑥3+𝑏𝑥2+𝑐𝑥+𝑑
𝑦=𝑎𝑥4+𝑏𝑥3+𝑐 𝑥2+𝑑𝑥+𝑒
![Page 2: Supplement: Curve Fitting aka . . . Choosing the appropriate model to fit the data](https://reader035.vdocument.in/reader035/viewer/2022062816/568161e2550346895dd1fa0b/html5/thumbnails/2.jpg)
• Linear family• Domain: ℝ• Range: ℝ• One y-intercept• Positive or
negative slope.
![Page 3: Supplement: Curve Fitting aka . . . Choosing the appropriate model to fit the data](https://reader035.vdocument.in/reader035/viewer/2022062816/568161e2550346895dd1fa0b/html5/thumbnails/3.jpg)
• Quadratic Family
• Domain: ℝ• Range: depends
on vertex• Opens up
(positive a) or down (negative a)
![Page 4: Supplement: Curve Fitting aka . . . Choosing the appropriate model to fit the data](https://reader035.vdocument.in/reader035/viewer/2022062816/568161e2550346895dd1fa0b/html5/thumbnails/4.jpg)
• Cubic Family• Domain: ℝ• Range: ℝ• Increases left to
right (positive a) or decreases left to right (negative a)
![Page 5: Supplement: Curve Fitting aka . . . Choosing the appropriate model to fit the data](https://reader035.vdocument.in/reader035/viewer/2022062816/568161e2550346895dd1fa0b/html5/thumbnails/5.jpg)
• Quartic Family• Domain: ℝ• Range:
depends on relative maxima/minima
• Opens up (positive a) or down (negative a)
![Page 6: Supplement: Curve Fitting aka . . . Choosing the appropriate model to fit the data](https://reader035.vdocument.in/reader035/viewer/2022062816/568161e2550346895dd1fa0b/html5/thumbnails/6.jpg)
Curve Fitting: Find the curve of best fit for a given set of data. This means finding an equation that models the data closely with the smallest error. There are several options; we will concentrate on the bolded ones in this unit:• Linear• Quadratic• Cubic• Quartic• Logarithmic• Exponential• Power• Logistic• Sinusoidal
Parts of this lesson adapted from:• www.adventures-in-education.com/Books/Linear and Curve
Fitting.htm• www.usciences.edu/~lvas/Math101/Poly_Regressions.pdf
![Page 7: Supplement: Curve Fitting aka . . . Choosing the appropriate model to fit the data](https://reader035.vdocument.in/reader035/viewer/2022062816/568161e2550346895dd1fa0b/html5/thumbnails/7.jpg)
Remember Linear Regression? Let’s review it.
Height (in) Weight (lbs)58 120
60 90
62 105
65 120
66 130
67 124
69 162
69 134
74 122
76 185
1. Turn on STAT PLOT 1.2. Input the data into L1 and L2.3. ZOOM9:ZoomStat4. STAT CALC 4:LinReg ENTER5. VARS Y-VARS 1:Function
ENTER6. FUNCTION 1:Y1 ENTER7. ENTER
If you do not get R and R2 turn DIAGNOSTICS ON.
𝑦=3.45 𝑥−100.62
![Page 8: Supplement: Curve Fitting aka . . . Choosing the appropriate model to fit the data](https://reader035.vdocument.in/reader035/viewer/2022062816/568161e2550346895dd1fa0b/html5/thumbnails/8.jpg)
If the data is NOT linear, you need to explore other options.
Speed of Car (miles)
Gas Consumption
(gallons)
20 5.2
30 5.8
40 6.2
50 6.4
60 6.4
70 6.2
80 5.8
Use successive differences between the y-values to determine which model fits best. If the first are equal (or closest to each other) then it is linear; if second equal, then quadratic; if third equal, then cubic, etc.
0.6
0.4
0.2
0
-0.2
-0.4
-0.2
-0.2
-0.2
-0.2
-0.2
Linear1Y Quadratic
2Y
![Page 9: Supplement: Curve Fitting aka . . . Choosing the appropriate model to fit the data](https://reader035.vdocument.in/reader035/viewer/2022062816/568161e2550346895dd1fa0b/html5/thumbnails/9.jpg)
If the data is NOT linear, you need to explore other options.
Speed of Car (miles)
Gas Consumption
(gallons)
20 5.2
30 5.8
40 6.2
50 6.4
60 6.4
70 6.2
80 5.8
Looking at the graph, it is obvious that the data is not linear!
1. Turn on STAT PLOT 1.2. Input the data into L1 and L2.3. ZOOM9:ZoomStat4. STAT CALC 5:QuadReg ENTER5. VARS Y-VARS 1:Function
ENTER6. FUNCTION 1:Y1 ENTER7. ENTER
![Page 10: Supplement: Curve Fitting aka . . . Choosing the appropriate model to fit the data](https://reader035.vdocument.in/reader035/viewer/2022062816/568161e2550346895dd1fa0b/html5/thumbnails/10.jpg)
Sometimes things are not quite clear. What would you choose for this blind data set.
x y1 -4
2 0
3 1
4 0
5 -2
6 0
7 3
8 15
The cubic looks the most promising. Or you can try putting the quadratic in Y1, the cubic in Y2, and the quartic in Y3.
4
1
-1
-2
2
3
12
-3
-2
1
5
1
9
Linear1Y Quadratic
2YCubic3Y
1
3
4
4
8
Quartic4Y
2
1
0
4
![Page 11: Supplement: Curve Fitting aka . . . Choosing the appropriate model to fit the data](https://reader035.vdocument.in/reader035/viewer/2022062816/568161e2550346895dd1fa0b/html5/thumbnails/11.jpg)
x y1 -4
2 0
3 1
4 0
5 -2
6 0
7 3
8 15
1. Input the data into L1 and L2.2. ZOOM9:ZoomStat3. STAT CALC 5:QuadReg ENTER4. VARS Y-VARS 1:Function ENTER5. FUNCTION 1:Y1 ENTER6. ENTER (Record the r2 value.)7. STAT CALC 6:CubicReg ENTER8. VARS Y-VARS 1:Function ENTER9. FUNCTION 2:Y2 ENTER10.ENTER (Record the r2 value.)11. STAT CALC 7:QuartReg ENTER12.VARS Y-VARS 1:Function ENTER13.FUNCTION 3:Y3 ENTER14.ENTER (Record the r2 value.)15.Y= (change line types)
![Page 12: Supplement: Curve Fitting aka . . . Choosing the appropriate model to fit the data](https://reader035.vdocument.in/reader035/viewer/2022062816/568161e2550346895dd1fa0b/html5/thumbnails/12.jpg)
The data increases then decreases and then increases which more closely resembles a CUBIC polynomial. Therefore, the CUBIC is the more appropriate model with R2=.9910. Also, when you ZoomOut, it is clear that the QUARTIC is not an appropriate model.
![Page 13: Supplement: Curve Fitting aka . . . Choosing the appropriate model to fit the data](https://reader035.vdocument.in/reader035/viewer/2022062816/568161e2550346895dd1fa0b/html5/thumbnails/13.jpg)
Healthcare costs have been increasing over the years. The following data shows the average cost of healthcare per person from 1976 to 1998. Let x = 0 denote 1970. find a model that fits the data well. Then find the year when the average healthcare cost reached $2800 per person.
Year $ (per person)1976 618
1980 860
1987 1324
1993 1865
1998 2256
1. Input data into L1 and L2.2. Run quadratic, cubic, and quartic
regressions sending equations to Y1, Y2, and Y3 respectively.
3. Record the R2 values.
![Page 14: Supplement: Curve Fitting aka . . . Choosing the appropriate model to fit the data](https://reader035.vdocument.in/reader035/viewer/2022062816/568161e2550346895dd1fa0b/html5/thumbnails/14.jpg)
Let x = 0 denote 1970. Find a model that fits the data well. Then find the year when the average healthcare cost reached $2800 per person.
Discussion: It is important to examine the graphs while zooming out from the data rather than just comparing R2 values. The R2 indicates how well the curve passes through the data points but does not indicate the correct overall trend or pattern.
The cubic model increases the complexity of the equation without changing the value of R2 by much. The quartic model appears accurate since R2=1.
However, both the cubic and the quartic start decreasing at a certain point which the data does not indicate. Therefore, the quadratic is the best model to choose.
QuadraticCubic
Quartic
![Page 15: Supplement: Curve Fitting aka . . . Choosing the appropriate model to fit the data](https://reader035.vdocument.in/reader035/viewer/2022062816/568161e2550346895dd1fa0b/html5/thumbnails/15.jpg)
1. Clear the cubic and quartic models from Y2 and Y3.
2. Enter 2800 in Y2.3. Look at the graph.4. CALC 5:Intersect Enter.5. At First curve? prompt, select Enter.6. At Second curve? prompt, select Enter.7. Use left/right arrows keys to move
cursor to best guess of intersection, then select Enter.
8. 27.5 + 1976 = 2003.5 so in the year 2003, the healthcare costs reached $2800 per person.
NOTE: Use the up/down arrow keys to select between curves.
![Page 16: Supplement: Curve Fitting aka . . . Choosing the appropriate model to fit the data](https://reader035.vdocument.in/reader035/viewer/2022062816/568161e2550346895dd1fa0b/html5/thumbnails/16.jpg)
The population in a bacteria culture over 5 days s given in the table below. Find a good model for the data. Estimate the population after 7 days.Time (days) Population
0 30
1 133
2 214
3 337
4 527
5 819
1. Input data into L1 and L2.2. Run quadratic, cubic, and quartic
regressions sending equations to Y1, Y2, and Y3 respectively.
3. Record the R2 values.4. Examine and choose.5. Answer the question.
Discussion: If we are only interested in the first seven days, then all models fit the data closely and we do not need to worry about the overall trend. In this case, the cubic model has a higher R2 value than the quadratic so choose cubic over quadratic. Although the quartic has a slightly higher R2 value than cubic they are almost the same and therefore there is no need to add complexity. The best model is the CUBIC.
𝑦=6.44 𝑥3−23.60 𝑥2+114.86 𝑥+31.23
![Page 17: Supplement: Curve Fitting aka . . . Choosing the appropriate model to fit the data](https://reader035.vdocument.in/reader035/viewer/2022062816/568161e2550346895dd1fa0b/html5/thumbnails/17.jpg)
1. Delete the quadratic and quartic models from Y1 and Y3.
2. Enlarge the viewing WINDOW so that you can see the y-value when x=7.
3. Select CALC1:ValueEnter.4. Type 7 Enter.5. On day 7 there will be approximately
1886 bacteria.
![Page 18: Supplement: Curve Fitting aka . . . Choosing the appropriate model to fit the data](https://reader035.vdocument.in/reader035/viewer/2022062816/568161e2550346895dd1fa0b/html5/thumbnails/18.jpg)
A company decides to develop a cost equation based on the quantity of the product produced in a day. Find a good model. How much will is cost the company to produce 195 units? How many units can they produce for $800?
Quantity Cost ($)20 642.35
35 766.48
50 858.82
65 928.83
80 1005.32
95 1078.82
110 1140.79
1. Input data into L1 and L2.2. Run quadratic, cubic, and quartic
regressions sending equations to Y1, Y2, and Y3 respectively.
3. Record the R2 values.4. Examine and choose.5. Answer the question.
Discussion: The leading coefficients of the cubic (.00033) and the quartic (-.0000098) are so small that they add complexity without adding much to accuracy (very similar R2 values). So . . . Look at the graphs and the data!
![Page 19: Supplement: Curve Fitting aka . . . Choosing the appropriate model to fit the data](https://reader035.vdocument.in/reader035/viewer/2022062816/568161e2550346895dd1fa0b/html5/thumbnails/19.jpg)
Discussion: Using the quadratic model, cost starts to decrease after units while the cubic cost continues to increase. So if you want a prediction for up to 195 units, use the quadratic model; for a prediction after 195 units, use the cubic. The quartic is rules out as it drops off rapidly which is unlike the data.
• Using the quadratic model, when x=195, y=$1287.
• Using the cubic model, when x=195, y=$1936.
• Using the quadratic model, when y=$800, x=42 units.
• Using the cubic model, when y=$800, x=41 units.
Quadratic
Cubic
Quartic
![Page 20: Supplement: Curve Fitting aka . . . Choosing the appropriate model to fit the data](https://reader035.vdocument.in/reader035/viewer/2022062816/568161e2550346895dd1fa0b/html5/thumbnails/20.jpg)
The table below shows the concentration of a drug in a patient’s bloodstream t hours after it was administered. Find a CUBIC model with a restricted domain 0.5 t 3. When was the concentration 0.1825 mg/cc?
Time (hours)
Concentration (mg/cc)
0.5 .16
1 .19
1.5 .2
2 .19
2.5 .18
3 .17
1. Input data into L1 and L2.2. Run cubic regression and send
equation to Y1.3. Enclose the equation in parentheses
and add the restricted domain using two inequalities.
4. Record the R2 value.5. Answer the question.
![Page 21: Supplement: Curve Fitting aka . . . Choosing the appropriate model to fit the data](https://reader035.vdocument.in/reader035/viewer/2022062816/568161e2550346895dd1fa0b/html5/thumbnails/21.jpg)
Discussion: If we were concerned with overall trend, the increasing nature of a cubic would not be a good model. However, if we are only interested in part of a cubic we can restrict the domain and only concern ourselves with that one section!
.1825 mg/cc at time = 0.8 and 2.4 hours.
)(0.5t3)9941
![Page 22: Supplement: Curve Fitting aka . . . Choosing the appropriate model to fit the data](https://reader035.vdocument.in/reader035/viewer/2022062816/568161e2550346895dd1fa0b/html5/thumbnails/22.jpg)
After winter break, 3 students came to school sick with the flu. The following table shows the number of students infected with the flu depending on the number of days after the winter break. Find the quadratic and quartic models that fit this data. Which model appears to be a better fit to the data? Using your chosen model, find the day at which the number of infected students reaches the maximum. When will the number of infected students drop to zero?
Time (days)
# Infected Students
0 3
5 6
10 14
15 23
20 23
25 21
30 9
1. Input data into L1 and L2.2. Run quadratic and quartic regressions
and send equations to Y1 and Y2, respectively.
3. Record the R2 values.4. Examine and choose.5. Answer the question.
![Page 23: Supplement: Curve Fitting aka . . . Choosing the appropriate model to fit the data](https://reader035.vdocument.in/reader035/viewer/2022062816/568161e2550346895dd1fa0b/html5/thumbnails/23.jpg)
Quartic has significantly higher R2 value.
Use CALCMaximum: Maximum number of infected students is 24 on day 19.5.
Use CALC Intersect: Zero infected students on day 33.