1
$\begingroup$

I am trying to use SPSS to build a linear regression on historical data (dependent and independent variables) and then apply this to new data (independent variables only) to generate predicted values and associated prediction intervals.

I've looked in detail at the documentation on the REGRESSION procedure within SPSS, and while it is obvious how I would get the prediction and interval for the data used to build the regression (using a /SAVE subcommand to save the temporary variables PRED, LICIN and UICIN) I'm not seeing any functionality that would allow me to apply this to new data.

Essentially I'm looking for the equivalent of PROC SCORE in SAS, or predict.lm in R.

$\endgroup$
3
  • $\begingroup$ I know it is not a real answer, but I would strongly recommend to use R for this purpose. To my knowledge SPSS is just not made for "reusing" results. However, you could just get the regression coefficients and simply use the COMPUTE command to compute the predicted values using the general forumal y = a + bx $\endgroup$
    – Henrik
    Commented Jun 8, 2011 at 9:15
  • $\begingroup$ If I could use R for this I would, however the client runs an SPSS house and is not keen to use R. The COMPUTE option would work if we were just after the mean estimate, but I'd like to get the prediction intervals out as well. $\endgroup$
    – deemar
    Commented Jun 8, 2011 at 9:35
  • $\begingroup$ Another option that might keep the client happy would be to use the R plugin in SPSS. $\endgroup$ Commented Jun 8, 2011 at 13:16

3 Answers 3

1
$\begingroup$

I believe the ability to save the parameter file and score new data is in quite older versions than 19, but a general solution is to stack the datasets and run the regression with the original data, then save the predicted values. As long as the hold out data has all of the independent variables SPSS will still provide predictions, even if the dependent variable is missing. Below is an example:

*Old data.
SET SEED 10.
MATRIX.
SAVE {UNIFORM(100,2)} /OUTFILE = * /VARIABLES = X1 X2.
END MATRIX.
DATASET NAME Old.
COMPUTE Y = 0.5*X1 + -0.2*X2 + RV.NORMAL(0,0.05).
EXECUTE.

*New data without Y.
MATRIX.
SAVE {UNIFORM(100,2)} /OUTFILE = * /VARIABLES = X1 X2.
END MATRIX.
DATASET NAME New.

*stack the files on top of one another.
DATASET ACTIVATE Old.
ADD FILES FILE = *
  /FILE = 'New'
  /IN = HoldOut.

*Now run the regression and save the predicted values.
REGRESSION
 /DEPENDENT Y
 /METHOD=ENTER X1 X2
 /SAVE=PRED(PredVal) ICIN(Int).

The ICIN command saves the upper and lower limits for the 95% prediction intervals to the new data.

$\endgroup$
3
  • $\begingroup$ And on the CRITERIA subcommand you can set the level of the prediction intervals using the CIN(??) option. $\endgroup$
    – Andy W
    Commented Feb 26, 2015 at 13:47
  • $\begingroup$ Also the same trick works in SAS. $\endgroup$
    – Andy W
    Commented Feb 26, 2015 at 13:50
  • $\begingroup$ Thanks. Although I've finished that project a long time ago now, your answer is just what I was looking for at the time. $\endgroup$
    – deemar
    Commented Mar 12, 2015 at 6:43
4
$\begingroup$

If you have SPSS Version 19, I believe they introduced "Scoring Wizard" under Utilities that apparently can accomplish this sort of task. That said, I have tried to get it to work and do not have the desire to debug the errors I am getting since it is very easy to do in R.

I echo @Jeromy's response; if you need to stay within SPSS, I would use the R plugin and the ?predict function.

$\endgroup$
2
  • $\begingroup$ SPSS version 15, unfortunately. While I'd love to use R, or SAS, or another stats package, this isn't an option in this case. $\endgroup$
    – deemar
    Commented Jun 10, 2011 at 4:54
  • $\begingroup$ IBM SPSS scoring wizard is a handy tool for just this purpose and offers outcome variables for both linear and nonlinear models www-01.ibm.com/support/knowledgecenter/SSLVMB_22.0.0/… $\endgroup$ Commented Feb 25, 2015 at 23:51
0
$\begingroup$

Why would you use linear regression on time series in the first place ? If you have time series data there may be lags required for all series and adjustments for Pulses , Level Shifts , Seasonal Pulses and /or Local Time Trends. Additionally you might have parameters that change over time (N.B. this is not rectified by Arima structure) and/or error variance that may change over time (N.B. Not necessarily rectified by Power Transforms such as reciprocal square roots, logs et. al.).You might need to update your tool set as you are abusing the methodology of linear regression by using it incorrectly on time series data. You should be using Transfer Function Models (Chapter 10) in the seminal BoX-Jenkins text on time series analysis. Routine implementation of these procedure facilitate re-use of models, re-estimating parameters and even augmenting the older model with newly identified structure from the "new data". Try Googling Transfer Functions or AUTOMATIC Transfer Functions

$\endgroup$
3
  • 1
    $\begingroup$ my reading of @deemar's question is that the data is not time series. It is just data collected in the past. $\endgroup$ Commented Jun 8, 2011 at 15:26
  • $\begingroup$ @Jeremy : You could be dead right on this. My problem is that I have a hammer and everything looks like a nail ! $\endgroup$
    – IrishStat
    Commented Jun 8, 2011 at 20:53
  • $\begingroup$ @Jeremy has it right, the data is not traditional time series data - i.e. we are not looking at predicting future values of a particular variable based on past (lagged) values of that particular variable along with (potentially) covariates. $\endgroup$
    – deemar
    Commented Jun 10, 2011 at 4:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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