Solved – Converting SPSS syntax for regression to Stata commands

regressionspssstata

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.

REGRESSION 
/SELECT=GROUP1 EQ 2 
/MISSING LISTWISE 
/STATISTICS COEFF OUTS R ANOVA 
/CRITERIA=PIN(.05) POUT(.10)
/NOORIGIN 
/DEPENDENT EFT
/METHOD=ENTER AGE IQ LANG 
/SAVE RESID (rEFT).

Best Answer

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).