I am running a series of regressions to eliminate the effects of IQ, language ability and age from my variables (task performance). To do this, the variable is entered as the dependent variable (e.g. EFT in syntax below) in a regression with IQ, language ability and age as predictor variables, selecting for control group only (GROUP1 EQ 2 is the control group). This regression equation is then applied to the other groups (GROUP1 = 0 & 1) and the residuals are collected.

The main problem I am having is converting the SPSS syntax below into Stata command (as I am relatively new to Stata). I need to use Stata to run the regression as my data are from related individuals and so I need to use the cluster command which isn't available in SPSS.

  • $\begingroup$ (+1) Although software-specific questions usually belong elsewhere, we might be the best possible place for stats/data analysis questions about how two (or more) stats programs compare or interact. I suggest refraining from voting to close. $\endgroup$
    – whuber
    Commented Oct 3, 2012 at 13:46

2 Answers 2


It's not clear to me why you want to do this, but anyway... This is a tentative based on what I've understood from your post.

regress eft age iq lang if group1 == 2, vce(cluster clustvar)
predict resid1 if inlist(group1, 0, 1), resid

Where clustvar is your cluster variable

(Please note that using vce(cluster clustvar) or not, won't change the residuals calculated with the second line of code, but of course it changes the standard errors of the linear regression).

  • $\begingroup$ (+1) andrea is right, cluster correction only applies to the standard errors. It seems to me, although zombie14600 did not really state that, that SPSS syntax above asks for a stepwise regression (argh... this is a terrible method), so I edited the suggested code. $\endgroup$
    – StasK
    Commented Oct 3, 2012 at 14:04
  • $\begingroup$ Yes, you're probably right @StasK (but as you say, it's a terrible method). Thanks for pointing that out. On a different note, is it only me who find it awkward to specify \NOORIGIN if you do want the intercept and \ORIGIN if you do not want the intercept? Probably it's just because I'm used to specify nocons (Stata) or noint (SAS), but it feels odd to me. Sorry if I've gone off topic. $\endgroup$
    – boscovich
    Commented Oct 3, 2012 at 14:13
  • 3
    $\begingroup$ @StasK, the regression syntax for SPSS does not ask for stepwise regression. It is an unfortunate side effect of code produced from menu's, it always includes the CRITERIA statement, even if all variables are included in the equation. The relevant portion of the SPSS code is the /METHOD=ENTER portion, it would say METHOD = BACKWARD or something like that for the model selection techniques. I am going to roll back, andrea's solution was correct previously. $\endgroup$
    – Andy W
    Commented Oct 3, 2012 at 14:21
  • $\begingroup$ Also I agree to intercept statement is a bit strange to view. Again it is a by-product of over-verbose code produced when using the GUI menu's, the defaults for both are logical when the substatements in SPSS are entirely excluded. $\endgroup$
    – Andy W
    Commented Oct 3, 2012 at 14:26

I don't know what you mean by saying cluster is not available in SPSS. Perhaps you need the MIXED procedure or one of several others that might apply here.

  • $\begingroup$ Care to provide an example? Do any of the newer bootstrapping commands although to bootstrap given a categorical variable? $\endgroup$
    – Andy W
    Commented Oct 4, 2012 at 15:59
  • $\begingroup$ Bootstrapping is factored out from the command. It should not care what the variables are. $\endgroup$
    – JKP
    Commented Oct 9, 2012 at 3:16
  • $\begingroup$ Well, I'm not quite sure what I originally meant to say in that garbled prose, but I believe where I was going is that, for clustered data, in SPSS can you stratify the bootstrap estimates by the cluster. That is, the bootstrap sub-sample typically re-samples based on entire clusters, not individual cases within clusters (at least that is how Stata does it, which is what the OP is originally asking about). $\endgroup$
    – Andy W
    Commented Oct 9, 2012 at 12:51

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.