Solved
Contributor
Posts: 49

Hi, what follows is a question on how to do a certain type of regression in SAS EG, and to clarify conceptuals around the term "quadratic".

Previously: I've been doing linear regression searching out an appropriate line equation to explain a relationship between two variables. To do this I've been going to "Tasks", selecting "Regression", and selecting "Linear Regression". No problem. Based on diagnostic plotting (Q-Q, Residual vs. Fit, and Cook's), and looking at standard transformations, (square root, and Ln), it looks like I'm dealing with a quadratic relationship between the two variables in question. I continually see a fan shaped relationship within my residual vs. fit regardless of transformation tweaks, and this intuitively makes sense when considering what I know about the two variables and how they interact.

Confusion: There seems to be some differences in what I'm finding online when looking at how to do quadratic regression in SAS. Some understand quadratic regression to be a form of non-linear regression, and some understand it as a modified version of linear regression. I assume the latter. A polynomial term–a quadratic (squared) or cubic (cubed) term turns a linear regression model into a curve. But because it is X that is squared or cubed, and not the Beta coefficient, it still qualifies as a linear model. Where would I go within SAS EG to do this?

Question: Where within the SAS EG interface does one do quadratic regression?

From y = a + ß1x

To     y = a + ß1x + ß2x^2

Confirmation of my understanding on quadratic regression as well as help figuring out where it is in SAS EG would be most helpful. I would not mind discussing SAS code used to accomplish the same, but prefer to use the Regression "wizard" at this point due to my timeline.

Any help would be greatly appreciated.

NS

Accepted Solutions
Solution
‎04-10-2015 08:48 AM
SAS Super FREQ
Posts: 4,242

You are correct that "linear regression" means linear in the (beta) coefficients. Thus there are two ways you can handle this situation:

1) Use a DATA step or a transformation in EG (under Query Builder, Computed Columns) to create a new variable called xSquared which is x**2.  Then do the usual linear regression on x and xSquared.

2) For more complicated interactions, use the Generalized Lineasr Regression task. After you specify x as the quantitative variable, click on the Model item in the left box. That takes you to a GUI that you can use to build interactions between variables. In your case, you would click on x and then click the Polynomial button (Degree=2) to the effects x and x*x will appear in the Effects column.

All Replies
Solution
‎04-10-2015 08:48 AM
SAS Super FREQ
Posts: 4,242

You are correct that "linear regression" means linear in the (beta) coefficients. Thus there are two ways you can handle this situation:

1) Use a DATA step or a transformation in EG (under Query Builder, Computed Columns) to create a new variable called xSquared which is x**2.  Then do the usual linear regression on x and xSquared.

2) For more complicated interactions, use the Generalized Lineasr Regression task. After you specify x as the quantitative variable, click on the Model item in the left box. That takes you to a GUI that you can use to build interactions between variables. In your case, you would click on x and then click the Polynomial button (Degree=2) to the effects x and x*x will appear in the Effects column.

Contributor
Posts: 49

Thanks Rick, I'll explore the above and report back. I appreciate the aid.

TS

Contributor
Posts: 49