Fitting polynomial data

30
© Bart Lauwers LSSBB, [email protected] Fitting Polynomial Data Fitting Polynomial Data with Linear Regression using Minitab

description

Training presentation explaining the techniques for using linear regression to fit polynomial data. Contact me via my profile for the minitab data files.

Transcript of Fitting polynomial data

Page 1: Fitting polynomial data

© Bart Lauwers LSSBB, [email protected] Polynomial Data

Fitting Polynomial Data

with Linear Regression using Minitab

Page 2: Fitting polynomial data

© Bart Lauwers LSSBB, [email protected] Polynomial Data

FITTING QUADRATIC DATA

Page 3: Fitting polynomial data

© Bart Lauwers LSSBB, [email protected] Polynomial Data

Visualizing the Data

5.02.50.0-2.5-5.0

40

30

20

10

0

X

YScatterplot of Y vs X

Graph>Scatterplot… Quadratic.MPJ

Page 4: Fitting polynomial data

© Bart Lauwers LSSBB, [email protected] Polynomial Data

Fitting the Data using Linear Regression Model

5.02.50.0-2.5-5.0

40

30

20

10

0

-10

X

Y

S 7.54763R-Sq 56.9%R-Sq(adj) 56.8%

Fitted Line PlotY = 7.324 + 2.998 X

Stat>Regression>Fitted Line Plot…

Page 5: Fitting polynomial data

© Bart Lauwers LSSBB, [email protected] Polynomial Data

Regression Analysis: Y versus X

The regression equation isY = 7.32 + 3.00 X

Predictor Coef SE Coef T PConstant 7.3238 0.3375 21.70 0.000X 2.9984 0.1169 25.64 0.000

S = 7.54763 R-Sq = 56.9% R-Sq(adj) = 56.8%

Stat>Regression>Regression…

Page 6: Fitting polynomial data

© Bart Lauwers LSSBB, [email protected] Polynomial Data

Calculating the Quadratic Term

Calc>Calculator…

Page 7: Fitting polynomial data

© Bart Lauwers LSSBB, [email protected] Polynomial Data

The regression equation isY = - 0.998 + 3.02 X + 0.999 X^2

Predictor Coef SE Coef T PConstant -0.99830 0.07765 -12.86 0.000X 3.01840 0.01793 168.31 0.000X^2 0.998671 0.006945 143.79 0.000

S = 1.15755 R-Sq = 99.0% R-Sq(adj) = 99.0%

Stat>Regression>Regression…

Regression Analysis: Y versus X, X^2

Page 8: Fitting polynomial data

© Bart Lauwers LSSBB, [email protected] Polynomial Data

Stat>Regression>Fitted Line Plot…

Polynomial Regression Analysis: Y versus X

The regression equation isY = - 0.9983 + 3.018 X + 0.9987 X**2

S = 1.15755 R-Sq = 99.0% R-Sq(adj) = 99.0%

Analysis of Variance

Source DF SS MS F PRegression 2 65163.9 32582.0 24316.13 0.000Error 497 665.9 1.3Total 499 65829.9

Sequential Analysis of Variance

Source DF SS F PLinear 1 37460.5 657.59 0.000Quadratic 1 27703.5 20675.26 0.000

Page 9: Fitting polynomial data

© Bart Lauwers LSSBB, [email protected] Polynomial Data

Fitting the Data using Quadratic Regression Model

Stat>Regression>Fitted Line Plot…

5.02.50.0-2.5-5.0

40

30

20

10

0

X

Y

S 1.15755R-Sq 99.0%R-Sq(adj) 99.0%

Fitted Line PlotY = - 0.9983 + 3.018 X

+ 0.9987 X**2

Page 10: Fitting polynomial data

© Bart Lauwers LSSBB, [email protected] Polynomial Data

FITTING POLYNOMIAL DATA

Page 11: Fitting polynomial data

© Bart Lauwers LSSBB, [email protected] Polynomial Data

Visualizing the Data

5.02.50.0-2.5-5.0

300

250

200

150

100

50

0

X

YScatterplot of Y vs X

Graph>Scatterplot… Polynomial.MPJ

Page 12: Fitting polynomial data

© Bart Lauwers LSSBB, [email protected] Polynomial Data

Fitting the Data using Linear Regression Model

5.02.50.0-2.5-5.0

300

250

200

150

100

50

0

X

Y

S 59.0593R-Sq 0.9%R-Sq(adj) 0.7%

Fitted Line PlotY = 50.89 - 1.931 X

Stat>Regression>Fitted Line Plot… (linear regression model)

Page 13: Fitting polynomial data

© Bart Lauwers LSSBB, [email protected] Polynomial Data

Calculating the 2nd through 5th Degree Polynomial Terms

Calc>Calculator…

Page 14: Fitting polynomial data

© Bart Lauwers LSSBB, [email protected] Polynomial Data

Stat>Regression>Regression…

Regression Analysis: Y versus X - X^5

The regression equation isY = - 7.48 + 3.01 X + 7.09 X^2 - 2.98 X^3 - 0.00355 X^4 + 0.149 X^5

Predictor Coef SE Coef T PConstant -7.4753 0.1852 -40.35 0.000X 3.0137 0.1497 20.13 0.000X^2 7.08514 0.04640 152.70 0.000X^3 -2.97756 0.02353 -126.56 0.000X^4 -0.003554 0.002075 -1.71 0.087X^5 0.148801 0.000826 180.19 0.000

S = 2.20915 R-Sq = 99.9% R-Sq(adj) = 99.9%

Evaluate the P-values.• We notice that for X^4 the

P-value > 0.05. Therefore it must be removed from the regression!

Page 15: Fitting polynomial data

© Bart Lauwers LSSBB, [email protected] Polynomial Data

Stat>Regression>Regression…

Regression Analysis: Y versus X, X^2, X^3, X^5

The regression equation isY = - 7.28 + 3.02 X + 7.01 X^2 - 2.98 X^3 + 0.149 X^5

Predictor Coef SE Coef T PConstant -7.2850 0.1485 -49.06 0.000X 3.0164 0.1500 20.11 0.000X^2 7.00898 0.01328 527.66 0.000X^3 -2.97820 0.02357 -126.36 0.000X^5 0.148829 0.000827 179.91 0.000

S = 2.21346 R-Sq = 99.9% R-Sq(adj) = 99.9%

Page 16: Fitting polynomial data

© Bart Lauwers LSSBB, [email protected] Polynomial Data

FITTING A PURE POLYNOMIAL

Page 17: Fitting polynomial data

© Bart Lauwers LSSBB, [email protected] Polynomial Data

Visualizing the Data

5.02.50.0-2.5-5.0

300

250

200

150

100

50

0

X

YScatterplot of Y vs X

Graph>Scatterplot… Pure.MPJ

Page 18: Fitting polynomial data

© Bart Lauwers LSSBB, [email protected] Polynomial Data

Graph>Regression>Fitted Line Plot… (linear regression model)

Regression Analysis: Y versus X

The regression equation isY = 55.10 - 1.961 X

S = 59.0735 R-Sq = 0.9% R-Sq(adj) = 0.7%

Analysis of Variance

Source DF SS MS F PRegression 1 16017 16016.8 4.59 0.033Error 498 1737857 3489.7Total 499 1753874

Page 19: Fitting polynomial data

© Bart Lauwers LSSBB, [email protected] Polynomial Data

Fitting the Data using Linear Regression Model

5.02.50.0-2.5-5.0

300

250

200

150

100

50

0

X

Y

S 59.0735R-Sq 0.9%R-Sq(adj) 0.7%

Fitted Line PlotY = 55.10 - 1.961 X

Graph>Regression>Fitted Line Plot… (linear regression model)

Page 20: Fitting polynomial data

© Bart Lauwers LSSBB, [email protected] Polynomial Data

Graph>Regression>Fitted Line Plot… (quadratic regression model)

Polynomial Regression Analysis: Y versus X

The regression equation isY = - 2.646 - 1.822 X + 6.929 X**2

S = 28.5157 R-Sq = 77.0% R-Sq(adj) = 76.9%

Analysis of Variance

Source DF SS MS F PRegression 2 1349741 674870 829.95 0.000Error 497 404133 813Total 499 1753874

Sequential Analysis of Variance

Source DF SS F PLinear 1 16017 4.59 0.033Quadratic 1 1333724 1640.20 0.000

Quadratic.MPJ

Page 21: Fitting polynomial data

© Bart Lauwers LSSBB, [email protected] Polynomial Data

Fitting the Data using Quadratic Regression Model

5.02.50.0-2.5-5.0

300

250

200

150

100

50

0

X

Y

S 28.5157R-Sq 77.0%R-Sq(adj) 76.9%

Fitted Line PlotY = - 2.646 - 1.822 X

+ 6.929 X**2

Graph>Regression>Fitted Line Plot… (quadratic regression model)

Page 22: Fitting polynomial data

© Bart Lauwers LSSBB, [email protected] Polynomial Data

Graph>Regression>Fitted Line Plot… (cubic regression model)

Polynomial Regression Analysis: Y versus X

The regression equation isY = - 2.821 - 19.32 X + 6.964 X**2 + 1.167 X**3

S = 18.0209 R-Sq = 90.8% R-Sq(adj) = 90.8%

Analysis of Variance

Source DF SS MS F PRegression 3 1592796 530932 1634.88 0.000Error 496 161078 325Total 499 1753874

Page 23: Fitting polynomial data

© Bart Lauwers LSSBB, [email protected] Polynomial Data

Fitting the Data using Cubic Regression Model

5.02.50.0-2.5-5.0

300

250

200

150

100

50

0

X

Y

S 18.0209R-Sq 90.8%R-Sq(adj) 90.8%

Fitted Line PlotY = - 2.821 - 19.32 X

+ 6.964 X**2 + 1.167 X**3

Graph>Regression>Fitted Line Plot… (cubic regression model)

Page 24: Fitting polynomial data

© Bart Lauwers LSSBB, [email protected] Polynomial Data

Calculating the 2nd through 5th Degree Polynomial Terms

Calc>Calculator…

Page 25: Fitting polynomial data

© Bart Lauwers LSSBB, [email protected] Polynomial Data

The regression equation isY = - 3.00 + 3.00 X + 7.00 X^2 - 3.00 X^3 + 0.000000 X^4 + 0.150 X^5

Predictor Coef SE Coef T PConstant -3.00000 0.00000 * *X 3.00000 0.00000 * *X^2 7.00000 0.00000 * *X^3 -3.00000 0.00000 * *X^4 0.00000000 0.00000000 * *X^5 0.150000 0.000000 * *

S = 0 R-Sq = 100.0% R-Sq(adj) = 100.0%

Stat>Regression>Regression…

Regression Analysis: Y versus X - X^5

The actual polynomial equation was:

Page 26: Fitting polynomial data

© Bart Lauwers LSSBB, [email protected] Polynomial Data

EXERCISE

Page 27: Fitting polynomial data

© Bart Lauwers LSSBB, [email protected] Polynomial Data

Exercise Data Visualized

-4 -3 -2 -1 0 1 2 3 4

-150

-100

-50

0

50

100

150

Exercise.MPJ

Page 28: Fitting polynomial data

© Bart Lauwers LSSBB, [email protected] Polynomial Data

Exercise Objectives

• Visualize the Data using Minitab.• Will any of the built-in regression models match this data?• Use the technique explained above to find the coefficients for the

polynomial terms.

Page 29: Fitting polynomial data

© Bart Lauwers LSSBB, [email protected] Polynomial Data

Solution

• The equation was:

• What were your results? Explain the variance.

Page 30: Fitting polynomial data

© Bart Lauwers LSSBB, [email protected] Polynomial Data