2
$\begingroup$

I've produced a large dataset of results from 3 variable inputs. eg:

x1, x2, x3 -> y

y(x1,x2,x3)

I've gone over the problem logically and it was clear the problem was non linear. To this end I've used a polynomial collection based on x1, x2, and x3 (eg. x1^2 and x1*x2) to perform linear regression. I've got a great set of results. my p-values for each variable (treating x1 and x1^2 as separate variables) are all around 0. My R^2 value is 0.995. I'm pretty happy with this outcome.

However, how can I present this data in a useful manner? I can't work out how to graph the data in any useful way, and I have about 400 different combinations of x1, x2 and x3, so I can't really present the whole table. The equation and statistics are OK but I feel that I should have something which shows the data in a little more detail.

Thanks!

Edit: I left some ambiguity in '400 combinations' The 400 combinations are 400 different combinations used for x1, x2, x3 as inputs. Not 400 different combination of x1x2, x1x3 x1^2x3 etc.

$\endgroup$
  • $\begingroup$ If you have 400 different models with just 3 variables, then I am doubtful that the statistics are OK. $\endgroup$ – Peter Flom - Reinstate Monica Apr 14 '14 at 12:20
  • $\begingroup$ I'm not sure I understand your point. I have one model that takes in the 3 variables. I've ran this model 400 times with different combinations of the 3 variables and got answers out. I've shown there is a good correlation between the inputs and the outputs and I'm interested in how best to present this information. Why are you doubtful of my statistics based on this? $\endgroup$ – FraserOfSmeg Apr 14 '14 at 12:34
  • $\begingroup$ Because to get 400 different combinations of 3 variables you have to be doing a lot of very complex transformations. It sounds like data dredging. $\endgroup$ – Peter Flom - Reinstate Monica Apr 14 '14 at 12:43
  • $\begingroup$ Why would I have to do a lot of complex transformations. The variables are independent of one another. So I could get 400 combination simply by randomly changing the 3 variables 400 times. Of course this might yield repetition so I took a more logical approach, and stepped through a range for each variable. I'm unsure of where the confusion is here. $\endgroup$ – FraserOfSmeg Apr 14 '14 at 12:45
  • $\begingroup$ There are only 8 combinations of 3 variables that don't involve transformations or powers. I think I am misunderstanding what you did. Can you give some examples of the 400? $\endgroup$ – Peter Flom - Reinstate Monica Apr 14 '14 at 13:12
1
$\begingroup$

So I will start off by saying that you could add as many polynomial terms and interactions as you want until you get a near perfect $R^2$, so that in an of itself doesn't make it a correct model. But how to display those complicated non-linear effects and interactions is a good question. Of course a table with much fewer of those terms are impossible to interpret - let alone one with hundreds of terms.

With three variables though our problem is not so bad if we simply plot the predictions of the model. So here I generated three sets of variables, X1, X2 & X3 from a normal distribution with a mean of 0 and a variance of 1. I then created a variable Y that is the following function of the X's:

COMPUTE Y = 5 + 0.6*(X1) + 0.2*(X2) + -3*(X3) + 
            0.38*(X1**2) + 0.15*(X2**2) + -0.1*(X3**2) +
            0.3*(X1*X2) + -0.1*(X2*X3) + RV.NORMAL(0,1).

This includes quadratic terms and interactions. RV.NORMAL(0,1) is the SPSS statement for generative a random variable normally distributed with a mean of 0 and a standard deviation of 1 - so Y has a bit of random error. Here is what the estimated regression coefficients look like:

enter image description here

So that is only helpful for hypothesis testing, not really understanding the predictions our model is making. So what I did to plot the predictions was create a new set of data with all of the X's regularly distributed between -2 and 2 with intervals of .4. I then create all of the polynomial and interaction terms and then score the model on this new data, generate predictions, and then create line plots of those predictions.

enter image description here

To interpret this plot, the Y axis plots the predicted value of Y from the model. The X axis is the value of X1, the panels are the values of X3 in the .4 increments, and the separate lines correspond to the same increments for X2. I chose a continuous color ramp for X2, as matching the exact interval to the colors is difficult. But you can see here it is a smooth function, where green corresponds to low values of X2 and purple corresponds to high values of X2.

This concept of generating predicted values of the model over reasonable sets of covariates extends to basically any type of regression model. My experience is that many models with more complicated polynomial and interaction terms tend to produce similar predictions over typical covariate values - it is in the tails that the predictions diverge (which you should be wary of extrapolating to the tails in most circumstances anyway).

$\endgroup$
  • $\begingroup$ Thank you for your answer. I had previously looked at using multiple graphs and it seem that this is the way to go. I just wanted to check that there wasn't a better way that I had overlooked. $\endgroup$ – FraserOfSmeg Apr 14 '14 at 13:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.