How to plot a quadratic interaction (moderated regression)

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How to plot a quadratic interaction (moderated regression)

Sakari Lemola
Dear list

I would like to plot the interaction of a quadratic and a linear predictor
(moderated qudratic regression). As I have the quadratic term of one
variable as a predictor in the regression model I actually ran a (linear)
multiple regression (the quadratic term was also used to build the
interaction term). When I tried to plot the interaction (with -1sd, average,
and +1sd on both variables) I got 3 straight lines instead of 3 curves. How
shall I proceed to plot these curves?

Thank you for your help!

Sakari Lemola

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: How to plot a quadratic interaction (moderated regression)

Trejtowicz, Mariusz
Dear Sakari,


Which SPSS' version do you use? In SPSS 17 (and I'm not sure, but
probably also in v16) you can use GPL to "draw" curves from equations.
You need to know model's parameter estimates, as well as descriptives
for both predictors and unstandarized predicted value.


E.g.:


* Dependent variable = y .
* Independent variables = x * z .
* Note: variable x entered to linear model as quadratic term : (x**2) .

* Estimated model: y = -52.46 + 12.7*(x**2) + 15.18*z  - 1.07*(x**2)*z.

* Descriptive statistics for z: .
*                mean = 9.894 .
*                sd = 1.522 .
* Calculations for interaction chart: .
*                -1 SD (z) = 8.372 .
*                Mean (z) = 9.894 .
*                +1 SD (z) = 11.416 .

* Descriptive statistics for x: .
*                mean = 0.005 .
*                sd = 2.205 .

* Descriptive statistics for model's unstandarized predicted value: .
*                mean = 106.94 .
*                sd = 20.248 .


* Multiple line chart from equations .
GGRAPH
/GRAPHDATASET NAME="graphdataset"
/GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
 PAGE: begin(scale(600px,600px))
 SOURCE: s=userSource(id("graphdataset"))
 DATA: xs = iter(-2,2,0.01)
 TRANS: y1 = eval( ((-52.46 + 12.7*((xs*2.205+0.005)**2) + 15.18*(8.372)
-1.07*((xs*2.205+0.005)**2)*(8.372))-106.94)/20.248 )
 TRANS: y2 = eval( ((-52.46 + 12.7*((xs*2.205+0.005)**2) + 15.18*9.894
-1.07*((xs*2.205+0.005)**2)*9.894)-106.94)/20.248 )
 TRANS: y3 = eval( ((-52.46 + 12.7*((xs*2.205+0.005)**2) + 15.18*11.416
-1.07*((xs*2.205+0.005)**2)*11.416)-106.94)/20.248 )
 GUIDE: axis(dim(1), label("x (standarized)"))
 GUIDE: axis(dim(2), label("y (standarized predicted value)"))
 SCALE: linear(dim(2), min(-2.2), max(2))
 ELEMENT: line(position(xs*y1), shape(shape.dash_dash2x), label("-1
SD"))
 ELEMENT: line(position(xs*y2), shape(shape.half_dash),
label("Avarege"))
 ELEMENT: line(position(xs*y3), shape(shape.dash), label("+1 SD"))
 PAGE: end()
END GPL.



Inside BEGIN GPL - END GPL command:
 - after DATA statement, vector of standarized x values ("xs") in
declared with range from -2 to 2 and 0.01 used as a step between values
 - after TRANS statements, standarized predicted values for y are
computed (model parameters are used here, standarized value of x - "xs"
- is de-standarized, while final y value prediction is standarized)
 - there are some statements used in this example for esthetic reasons;
I hope that they will be ok also with your data, otherwise please
contact me

You need to modify this example with use of proper statistics from your
data and model. Hope that helps.


Best regards,
Mariusz Trejtowicz





-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Sakari Lemola
Sent: Tuesday, March 03, 2009 2:03 PM
To: [hidden email]
Subject: How to plot a quadratic interaction (moderated regression)


Dear list

I would like to plot the interaction of a quadratic and a linear
predictor
(moderated qudratic regression). As I have the quadratic term of one
variable as a predictor in the regression model I actually ran a
(linear)
multiple regression (the quadratic term was also used to build the
interaction term). When I tried to plot the interaction (with -1sd,
average,
and +1sd on both variables) I got 3 straight lines instead of 3 curves.
How
shall I proceed to plot these curves?

Thank you for your help!

Sakari Lemola

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: How to plot a quadratic interaction (moderated regression)

Sakari Lemola
Thanks Mariusz

Thanks for this useful hint. By the help of an Excel template which I got
from Jeremy Dawson the problem could be solved.
http://www.jeremydawson.co.uk/slopes.htm
(this template, however, is not on the website).

Sincerely yours

Sakari



Am 7.3.2009 0:40 Uhr schrieb "Trejtowicz, Mariusz" unter
<[hidden email]>:

> Dear Sakari,
>
>
> Which SPSS' version do you use? In SPSS 17 (and I'm not sure, but
> probably also in v16) you can use GPL to "draw" curves from equations.
> You need to know model's parameter estimates, as well as descriptives
> for both predictors and unstandarized predicted value.
>
>
> E.g.:
>
>
> * Dependent variable = y .
> * Independent variables = x * z .
> * Note: variable x entered to linear model as quadratic term : (x**2) .
>
> * Estimated model: y = -52.46 + 12.7*(x**2) + 15.18*z  - 1.07*(x**2)*z.
>
> * Descriptive statistics for z: .
> *                mean = 9.894 .
> *                sd = 1.522 .
> * Calculations for interaction chart: .
> *                -1 SD (z) = 8.372 .
> *                Mean (z) = 9.894 .
> *                +1 SD (z) = 11.416 .
>
> * Descriptive statistics for x: .
> *                mean = 0.005 .
> *                sd = 2.205 .
>
> * Descriptive statistics for model's unstandarized predicted value: .
> *                mean = 106.94 .
> *                sd = 20.248 .
>
>
> * Multiple line chart from equations .
> GGRAPH
> /GRAPHDATASET NAME="graphdataset"
> /GRAPHSPEC SOURCE=INLINE.
> BEGIN GPL
>  PAGE: begin(scale(600px,600px))
>  SOURCE: s=userSource(id("graphdataset"))
>  DATA: xs = iter(-2,2,0.01)
>  TRANS: y1 = eval( ((-52.46 + 12.7*((xs*2.205+0.005)**2) + 15.18*(8.372)
> -1.07*((xs*2.205+0.005)**2)*(8.372))-106.94)/20.248 )
>  TRANS: y2 = eval( ((-52.46 + 12.7*((xs*2.205+0.005)**2) + 15.18*9.894
> -1.07*((xs*2.205+0.005)**2)*9.894)-106.94)/20.248 )
>  TRANS: y3 = eval( ((-52.46 + 12.7*((xs*2.205+0.005)**2) + 15.18*11.416
> -1.07*((xs*2.205+0.005)**2)*11.416)-106.94)/20.248 )
>  GUIDE: axis(dim(1), label("x (standarized)"))
>  GUIDE: axis(dim(2), label("y (standarized predicted value)"))
>  SCALE: linear(dim(2), min(-2.2), max(2))
>  ELEMENT: line(position(xs*y1), shape(shape.dash_dash2x), label("-1
> SD"))
>  ELEMENT: line(position(xs*y2), shape(shape.half_dash),
> label("Avarege"))
>  ELEMENT: line(position(xs*y3), shape(shape.dash), label("+1 SD"))
>  PAGE: end()
> END GPL.
>
>
>
> Inside BEGIN GPL - END GPL command:
>  - after DATA statement, vector of standarized x values ("xs") in
> declared with range from -2 to 2 and 0.01 used as a step between values
>  - after TRANS statements, standarized predicted values for y are
> computed (model parameters are used here, standarized value of x - "xs"
> - is de-standarized, while final y value prediction is standarized)
>  - there are some statements used in this example for esthetic reasons;
> I hope that they will be ok also with your data, otherwise please
> contact me
>
> You need to modify this example with use of proper statistics from your
> data and model. Hope that helps.
>
>
> Best regards,
> Mariusz Trejtowicz
>
>
>
>
>
> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
> Sakari Lemola
> Sent: Tuesday, March 03, 2009 2:03 PM
> To: [hidden email]
> Subject: How to plot a quadratic interaction (moderated regression)
>
>
> Dear list
>
> I would like to plot the interaction of a quadratic and a linear
> predictor
> (moderated qudratic regression). As I have the quadratic term of one
> variable as a predictor in the regression model I actually ran a
> (linear)
> multiple regression (the quadratic term was also used to build the
> interaction term). When I tried to plot the interaction (with -1sd,
> average,
> and +1sd on both variables) I got 3 straight lines instead of 3 curves.
> How
> shall I proceed to plot these curves?
>
> Thank you for your help!
>
> Sakari Lemola
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: How to plot a quadratic interaction (moderated regression)

Milan Jordanov
In reply to this post by Sakari Lemola
Dear colleagues,
I would like to plot interaction when moderation variable is squared, not
predictor. Do you know some site or some other way how to plot that
interaction?

I am very grateful for reply.

Thanks for help, Milica



--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/How-to-plot-a-quadratic-interaction-moderated-regression-tp1087053p5726540.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: How to plot a quadratic interaction (moderated regression)

Bruce Weaver
Administrator
Why does it matter which variable is squared?  In either case, you want to plot fitted values of Y at selected combinations of the explanatory variables, right?  A convenient way to get those fitted values is to estimate the model with UNIANOVA (assuming you are talking about OLS linear regression) and including a bunch of EMMEANS sub-commands.  You can see an example here:

http://spssx-discussion.1045642.n5.nabble.com/interpretation-of-beta-coefficent-in-quadratic-regression-tp4422260p4422404.html

By doing it this way, you also get SEs and CIs for the fitted values.  

HTH.


Milan Jordanov wrote
Dear colleagues,
I would like to plot interaction when moderation variable is squared, not
predictor. Do you know some site or some other way how to plot that
interaction?

I am very grateful for reply.

Thanks for help, Milica



--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/How-to-plot-a-quadratic-interaction-moderated-regression-tp1087053p5726540.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).