0% found this document useful (0 votes)
8 views17 pages

Pracitcal 7 Polynomial Regression

Polynomial regression extends linear regression by modeling relationships as nth-degree polynomials, making it suitable for non-linear data patterns. It involves creating polynomial terms and using them in regression models to improve predictive accuracy. The document outlines steps for performing polynomial regression in SPSS, including data preparation, model creation, and evaluation metrics.

Uploaded by

easyupload999
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views17 pages

Pracitcal 7 Polynomial Regression

Polynomial regression extends linear regression by modeling relationships as nth-degree polynomials, making it suitable for non-linear data patterns. It involves creating polynomial terms and using them in regression models to improve predictive accuracy. The document outlines steps for performing polynomial regression in SPSS, including data preparation, model creation, and evaluation metrics.

Uploaded by

easyupload999
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

Polynomial regression

Polynomial Regression
• Polynomial regression is an extension of linear regression that models
the relationship between the independent variable(s) and the
dependent variable as an nth-degree polynomial.
• It is useful for capturing non-linear relationships in data.
• Polynomial regression is used when the relationship between the
independent variables is non-linear.
When to Use Polynomial regression
• Non-Linear Relationship
• When data does not follow a straight-line trend but instead follows a curved
pattern (e.g., U-shaped, inverted U-shaped, or S-shaped).
• Better Fit for Curved Trends
• If a scatter plot suggests a curvilinear pattern, polynomial regression can
provide a better fit than simple linear regression.
• Higher Accuracy in Certain Models
• Used when linear regression underfits the data and adding polynomial terms
improves predictive performance.
nth degree polynomial regression

Where

• β0, β1, β2… etc. are regression


• y is dependent variable

coefficients
• x is dependent variable
•  is error term
Polynomial regression for two
variables, 2nd degree
Steps for Polynomial Regression in
SPSS
• Load your data
• Open SPSS and load your dataset.
• Ensure that your dependent variable (Y) and independent variable (X) are
clearly defined.
• Create polynomial terms
• Polynomial regression requires you to create additional terms (e.g., X2, X3
etc.).
• To create these:
• Click Transform > Compute Variable.
• Enter a new name (e.g. X_squared)
• In the numeric box enter X**2
• Click Ok to create the square term.
• Repeat for higher order terms (e.g. X_cubed=X**3)
Enter Data
• Define Room_price (Independent) and
occupancy_rate (Dependent) variables.
• Enter the data values.
Check for linearity
• Make a scatter plot between room_price and occupancy_rate
variable.
• Clearly we can see relationship is
non-linear
• Then define new non-linear term,
Based on room_price by using
compute variable function.
Make a new variable of second order
• Go to Transform,
Compute variable
• Target variable name is
room_price_squared
• In numeric expression
box write,
room_price**2, this will
make square of
room_price variable.
Click Ok and go to data
view to check a new
variable is created.
Make a regression model
• Make a regression model based on room_price and
room_price_squared as independent variable.
• Occupancy rate as Dependent variable.
• Check all the assumptions of regression model.
• Save residual and predicted values
Output

1. Higher R2, 0.931


2. Durbin Watson is low, residuals aren’t independent ideal range is (1.5-
2.5)
Anova Table

1. Regression having significant effect as H0 is rejected


2. Under H0 , The regression model does not explain a significant amount
of variance in the dependent variable (Occupancy Rate), meaning that
all regression coefficients are equal to zero.
Checking the significance of
different components

1. All the components (room price and room_price_square) are significant


2. They're adding significant information to the model
3. VIF > 10, which means there is multicollinearity, assumption violated
4. Regression line is, y=252.425 +(-3.322*room_price) + 0.011* room_price_squared
Normality of residuals

1. Residuals may not be normally distributed, statistical tests are needed


Compute regression metrics
• Compute RMSE using compute variable: 8.80
• Compute MAE, using compute variable: 7.3390
• R2 is:0.931
• Regression line is, y=252.425 +(-3.322*room_price) + 0.011*
room_price_squared
• Use this line for predicting y, i.e. occupancy rate.
Line plot for the actual and
predicted values

This plot show the actual and


predicted y-variable (occupancy
rate) values. For a good model,
these two lines should coincide
or should be as close as possible.
Try a new regression model
• Try with cubical polynomial regression model
• Add extra independent variable, i.e. room_price_cubed

You might also like