SPSS tutorials

BASICS DATA ANALYSIS T-TEST ANOVA CHI-SQUARE TEST

Regression over Many Dependent Variables

"I have a data file on which I'd like to carry out several regression analyses. I have four dependent variables, v1 through v4. The independent variables (v5 through v14) are the same for all analyses. How can I carry out these four analyses in an efficient way that would also work for 100 dependent variables?"

SPSS Python Syntax Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
*Run REGRESSION repeatedly over different dependent variables.

begin program.
import spss,spssaux
dependent = 'v1 to v4' # dependent variables.
spssSyntax = '' # empty Python string that we'll add SPSS REGRESSION commands to
depList = spssaux.VariableDict(caseless = True).expand(dependent) # create Python list of variable names
for dep in deplist: # "+=" (below) concatenates SPSS REGRESSION commands to spssSyntax
    spssSyntax += '''
REGRESSION
/MISSING PAIRWISE
/STATISTICS COEFF OUTS R ANOVA
/CRITERIA=PIN(.05) POUT(.10)
/NOORIGIN
/DEPENDENT %s
/METHOD=STEPWISE v5 to v14.
'''%dep # replace "%s" in syntax by by dependent var
print spssSyntax # prints REGRESSION commands to SPSS output window
end program.

*If REGRESSION commands look good, have SPSS run them.

begin program.
spss.Submit(spssSyntax)
end program.

Description

Previous tutorial: Create Dictionary Dataset

Next tutorial: SPSS Missing Values Functions

Let me know what you think!

*Required field. Your comment will show up after approval from a moderator.

This tutorial has 20 comments