pspp-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PSPP linear regression (reference category).


From: Alan Mead
Subject: Re: PSPP linear regression (reference category).
Date: Thu, 29 Sep 2016 10:17:51 -0500
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0

I've always used syntax to create dummy variables and it works the same in PSPP and SPSS. 

If you had a categorical variable X with three values 0/1/2 you would create two dummy coded variables like this:

recode x (0=1) (1=0) (2=0) (ELSE=SYSMIS) into x_dum1.
recode x (0=0) (1=1) (2=0) (ELSE=SYSMIS) into x_dum2.
execute.

This creates two dummy variables called x_dum1 and x_dum2 and they encode the effect for category 0 and 1 (respectively) vs. category 2 as a reference.  If you wanted to use, say, group 1 as the reference, then you make sure that 1 is encoded as zero for both dummy variables:

recode x (0=1) (1=0) (2=0) (ELSE=SYSMIS) into x_dum1.
recode x (0=0) (1=0) (2=1) (ELSE=SYSMIS) into x_dum2.
execute.

Sometimes to give myself more flexibility, I create dummy codes for all three values and only pick two in any analysis.  This forces the category of the left out dummy variable to be the reference:

recode x (0=1) (1=0) (2=0) (ELSE=SYSMIS) into x_dum0.
recode x (0=0) (1=1) (2=0) (ELSE=SYSMIS) into x_dum1.
recode x (0=0) (1=0) (2=1) (ELSE=SYSMIS) into x_dum2.
execute.

For example, if you enter x_dum0 and x_dum2 then category 1 is the reference.  If you forget and enter all three dummy variables the regression should fail because the data matrix lacks full rank.

-Alan


On 9/29/2016 9:58 AM, Jack Drew wrote:
Thanks for the speedy response, Alan.

To be clear: if memory serves SPSS lets you specify the reference value for a categorical variable.  So for a variable with 0/1/2 values, you can specify '0' as the reference category.

However, if I understand you correctly, the method for PSPP is to create a dummy variable (0/1) for each of the 0/1/2 values and then exclude the dummy variable for 0 as the reference group.  You can run additional models and swap out the remaining variables to change reference group.

Jack

-- 

Alan D. Mead, Ph.D.
President, Talent Algorithms Inc.

science + technology = better workers

+815.588.3846 (Office)
+267.334.4143 (Mobile)

http://www.alanmead.org

I've... seen things you people wouldn't believe...
functions on fire in a copy of Orion.
I watched C-Sharp glitter in the dark near a programmable gate.
All those moments will be lost in time, like Ruby... on... Rails... Time for Pi.

          --"The Register" user Alister, applying the famous 
            "Blade Runner" speech to software development

reply via email to

[Prev in Thread] Current Thread [Next in Thread]