# Polynomial regression: how to plot several regression lines on same graph.

#### Pelican23

##### New Member
Hi there,

I am currently working on my thesis which is concerned with abnormality of differences between index scores on an intelligence test. An important factor here are the correlations between indexes. There are 4 indexes, hence 6 possible pairs. Correlations between indexes are provided for 13 age bands.

To investigate potential age effects on the correlations (and non-linear relationships) I carried out hierarchical multiple regression using polynomial functions of age (i.e. age_band, age_band_squared, age_band_cubed) as predictor variables and the correlation between a pair of indexes as dependent variable.

Example of regression equation: IndexA*IndexB = 0.2 + 0.13 x age - 0.02 x age_squared + 0.001 x age_cubed.

PROBLEM:
My supervisor now wants me to plot the regression lines of the 6 pairs of indexes all on one figure; with age as x-axis and correlation as y-axis. He doesn't want the actual data points in there but only the regression lines.

I tried to do this with SPSS, but can't work out how to plot different regression lines in the same graph.

Help would be greatly appreciated! Thanks!

#### ted00

##### New Member
have you used R? can do:

plot(x,y,type='n', ylim=c(ym,yM),xlim=c(xm,xM))
lines(x1,y1)
lines(x1,y2)
...
lines(x6,y6)

where ym,yM,xm,xM are the min's and max's of the plot regino

#### Pelican23

##### New Member
Thank you very much for your reply. I actually downloaded R today but I've never used it before. I find it quite difficult to make sense of it, but I'll give it a shot. This might be a stupid question, but do I have to carry out the regression before applying your commands? Thanks again #### ted00

##### New Member
If you want to plot fitted lines, then yes, you'll first need the coefficients, which come from running the regression