| Date: | Wed, 8 Nov 2000 13:52:02 -0800 |
| Reply-To: | John Hendrickx <john_hendrickx@YAHOO.COM> |
| Sender: | "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU> |
| From: | John Hendrickx <john_hendrickx@YAHOO.COM> |
| Subject: | Re: dummy variable |
|
| Content-Type: | text/plain; charset=us-ascii |
|---|
No, I was thinking of the method where you initialize the variable
first, or using "recode into". I thought this method would also
recode missings to 0. Thanks for pointing this out.
--- "Matheson, David" <dmatheson@SPSS.COM> wrote:
> John,
> I tested all of the methods in my solution with missing values
> in the
> categorical variable and all of them returned a missing value for
> all of the
> dummy variables in these cases. Do you have a counterexample?
> Take the first method in the post for example.
>
> VECTOR nom(4).
> LOOP #i = 1 to 4.
> COMPUTE nom(#i) = (cat = #i).
> END LOOP.
> EXECUTE.
>
> If the expression (cat = #i) is true, a 1 is returned; if false; a
> 0. If cat
> is missing, then the expression can't be evaluated and the result
> is system
> missing. If I had initialized the dummy variables to 0 before
> testing the
> value of cat, then missing values on cat would have been coded as
> all 0s
> like the reference category. None of these methods used such an
> initialization.
>
> There are some influence diagnostics in Regression that are not
> available in
> GLM or Unianova, but analysts with categorical predictors should
> certainly
> consider those latter options. (GLM is in the Advanced Models
> module but
> Unianova is in the SPSS Base module).
>
> David Matheson
> SPSS Technical Support
>
>
>
> -----Original Message-----
> From: John Hendrickx [mailto:J.Hendrickx@MAILBOX.KUN.NL]
> Sent: Wednesday, November 08, 2000 4:35 AM
> To: SPSSX-L@LISTSERV.UGA.EDU
> Subject: Re: dummy variable
>
>
> Unfortunately, these methods will code a missing value on the
> categorical variable to 0 rather than missing on the dummies. A
> workaround would be:
>
> temporary.
> select if not missing(cat).
> -- make dummies --
> regress ...
>
> But wouldn't it be simpler to just use GLM?
>
>
> --- "Matheson, David" <dmatheson@SPSS.COM> wrote:
> > This technical note has a few approaches to creating dummy
> > variables from a
> > categorical variable. You can also find it as solution 100000500
> on
> > the SPSS
> > AnswerNet at
> > http://www.spss.com/tech/answer/index.cfm .
> >
> > David Matheson
> > SPSS Technical Support
> >
> >
> > Recoding a categorical SPSS variable into indicator (dummy)
> > variables
> > Q.
> > What is the SPSS command to transform a nominal variable
> > of n classification groups into a series of n-1 indicator
> > (or "dummy") variables?
> >
> >
> > A.
> > Unfortunately, there is no single command to do this. There
> > are several short command sequences that can do it and
> > examples are provided below. Of these, the DO REPEAT
> > approach is somewhat more general, or at least easier if
> > the reference category is not the lowest value.
> >
> > * creating indicator variables.
> > * all examples below generate indicators from a
> > nominal variable, called cat, that is present in
> > the active file.
> >
> > * create 4 indicator variables for categories 1 to 4
> > of a 5-category variable called cat.
> >
> > VECTOR nom(4).
> > LOOP #i = 1 to 4.
> > COMPUTE nom(#i) = (cat = #i).
> > END LOOP.
> > EXECUTE.
> >
> > * alternatively .
> > * create 4 indicator variables for categories 2 to 5
> > of a 5-category variable called cat.
> >
> > VECTOR ind(4).
> > LOOP #i = 1 to 4.
> > COMPUTE ind(#i) = (cat = #i + 1).
> > END LOOP.
> > EXECUTE.
> >
> > * if you wanted to make the first category the reference
> > category (0 on all indicator vars) with var names reflecting
> > the original category : .
> >
> > NUMERIC dum2 to dum5.
> > VECTOR dumv = dum2 to dum5.
> > LOOP #i = 1 to 4.
> > COMPUTE dumv(#i) = (cat = #i + 1).
> > END LOOP.
> > EXECUTE.
> >
> > * creating similar vars as above but using do repeat command.
> > DO REPEAT iv = indv2 to indv5
> > / c = 2 to 5 .
> > COMPUTE iv = (cat = c).
> > END REPEAT.
> > EXECUTE.
> >
> > * if reference category were neither first nor last, but 3rd,
> > DO REPEAT seems handier than VECTOR and LOOP.
> >
> > DO REPEAT iv = c3i1 c3i2 c3i4 c3i5 / g = 1 2 4 5 .
> > COMPUTE iv = (cat = g).
> > END REPEAT.
> > EXECUTE.
> >
> > -----Original Message-----
> > From: Dirk Enzmann [mailto:enzmann@KFN-NT.KFN.UNI-HANNOVER.DE]
> > Sent: Tuesday, November 07, 2000 2:31 PM
> > To: SPSSX-L@LISTSERV.UGA.EDU
> > Subject: Re: dummy variable
> >
> >
> > There is no menu-option in SPSS for creating dummy variables for
> > regression analyses, but there is a SPSS-macro at
> > http://www.kfn.de/softwareenzmann.html
> > which might do what you want. It runs fine with SPSS 6.1 but I
> had
> > some
> > problems using it with SPSS 10 (perhaps Raynald Levesque could
> have
> > a
> > look at it? ;-)
> >
> > Dirk
> >
> > rina <rina@NURULFIKRI.COM> wrote:
> > > Is there any option in SPSS for make dummy variables for
> > regression
> > > analysis ?
> > > and I want to know about software for Principal Component
> > Regression
> > > Analysis,
> > > Can we use SPSS for this ?
> >
> >
__________________________________________________
Do You Yahoo!?
Thousands of Stores. Millions of Products. All in one Place.
http://shopping.yahoo.com/
|