Dear Steve:
Categorical variables are only recognized as such if they are
first classified as factors. So if you're just reading in data
from .dta or .tab or whathever, all fields containing numbers
(even binary fields, or categorical fields) are by default
numeric; fields that contain character strings are coerced to
character. You have to change the class of the numeric or
character variable to a factor varaible for setx() to recognize
it as a categorical response:
data$x <- as.factor(data$x) # or use factor()
Factors are described in:
http://gking.harvard.edu/zelig/docs/Types_of_Data.html
See item #2 on this page ("A factor vector allows...")
Yours,
Olivia Lau
----- Original Message -----
From: "Steve Purpura" <stevepurpura(a)yahoo.com>
To: "'Olivia Lau'" <olau(a)fas.harvard.edu>
Sent: Sunday, May 30, 2004 11:57 PM
Subject: RE: Setx()
Sorry for the confusion, Olivia. By miss-typing, I
mean
setting a
categorical variable to a continuous variable.
Steve
-----Original Message-----
From: Olivia Lau [mailto:olau@fas.harvard.edu]
Sent: Sunday, May 30, 2004 8:49 PM
To: Steve Purpura
Subject: Re: Setx()
Dear Steve:
Mis-typing a variable name usually gives an error message to
the effect that
"[variable] cannot be found". I actually
find this error
message pretty
informative: It tells you that the [variable] is not
in the
workspace or in
the dataframe, which means that you've made a
mistake. You
just have to be
careful and pay attention to your data (which are good
things
to do in any
case). There's no built-in R spell-checker,
unfortunately.
I found a design flaw (not a bug, much bigger) in setx() last
week and we're
working on it. There will be a revised function and a
new set
of examples
in the next few days, so keep an eye out for it.
Yours,
Olivia Lau
----- Original Message -----
From: "Steve Purpura" <stevepurpura(a)yahoo.com>
To: "'Olivia Lau'" <olau(a)fas.harvard.edu>
Sent: Sunday, May 30, 2004 11:18 PM
Subject: Setx()
> As preparation for my teaching aids, students ask me
questions
about how to
get Zelig to work for their models. The number
one problem
they experience
is in dealing with the error messages from
setx().
Typically, they are miss-typing a variable and setx() is
making a different
assumption than they desire. The error messages
that are
returned to the
student don't make any sense to them.
Do you have any advice on the process a researcher should go
through before
calling setx() to validate that their data will
be processed
as they believe
> it should? Alternatively, do you have any interesting
insight
into how to
> uncover the root cause of problems from setx() error
messages?
-
Zelig Mailing List, served by Harvard-MIT Data Center
Send messages: zelig(a)latte.harvard.edu
[un]subscribe Options:
http://lists.hmdc.harvard.edu/?info=zelig
Zelig program information:
http://gking.harvard.edu/zelig/