I apologize. Everything works Ok. I mistakenly interpreted the message as a warning
message.
Sincerely,
Olena Ageyeva
From: eageeva at
hotmail.com
To: gov2001-l at
lists.fas.harvard.edu
Date: Tue, 10 Mar 2009 12:56:36 -0400
Subject: Re: [gov2001-l] zelig()
Thanks, Brandon.
I have tried to make changes in my code as you suggested, but I still can't make it
work.
Here is my code:
load("shuttle.RData")
temperature<-as.numeric(data[,3])#separating variables
pressure<-as.numeric(data[,4])
incident<-as.numeric(data[,2])
data<-as.data.frame(cbind(incident,temperature, pressure))#making a data frame
z.out<-zelig(incident~temperature+pressure,model="logit", data= data)
Running this code I get just the following message and no results:
How to cite this model in Zelig:
Kosuke Imai, Gary King, and Oliva Lau. 2008. "logit: Logistic Regression for
Dichotomous Dependent Variables" in Kosuke Imai, Gary King, and Olivia Lau,
"Zelig: Everyone's Statistical Software,"
http://gking.harvard.edu/zelig
I did read the documentation about using zelig(), but it's still not clear to me how
to use it.
Sincerely,
Olena Ageyeva
Date: Tue, 10 Mar 2009 07:39:15 -0500
From: bstewart at
fas.harvard.edu
To: gov2001-l at
lists.fas.harvard.edu
Subject: Re: [gov2001-l] zelig()
Olena,
data.frame is an object class in R (all objects have classes in R) that is similar to a
matrix but more flexible. Your class is "numeric" after you have done
as.numeric. To get a dataframe, you need to combine all the different elements into one
dataset. See the following code as an example:
shuttle <- load("shuttle.RData")datatbc <- as.numeric(data) ##Data to be
convertedIncident <- datatbc[24:46] ##Make VariablesTemperature <- datatbc[47:69]
Pressure <- datatbc[70:92]data <- as.data.frame(cbind(Incident, Temperature,
Pressure)) ##Combine to make data framecheck <- zelig(Incident ~ Temperature +
Pressure, model="logit", data=data)
I converted the data, into a numeric vector (the object datatbc) and then sliced that
object into variables (the next three lines). Then by combining the three variables with
cbind() we create a matrix, that gets converted with "as.data.frame"
Finally, on the last line, I've added the relevant zelig code. I could have labeled
that variables data$Incident, data$Temperature etc. Specifying the "data" field
in Zelig (or most any other model in R) simply allows you to refer to objects with their
variable name inside the data frame rather than the dataframe, a dollar sign, the variable
name.
Brandon
On Tue, Mar 10, 2009 at 5:40 AM, Olena Ageyeva <eageeva at hotmail.com> wrote:
Have anyone tied it yet? What should be set as "data" parameter?
I keep getting an error message and have no idea how to fix it.
load("shuttle.RData")
dta<-data
z.out<-zelig(as.numeric(incident)~as.numeric(temperature)+as.numeric(pressure),model="logit",
data= dta)
Error in model.frame.default(formula = as.numeric(incident) ~
as.numeric(temperature) + :
'data' must be a data.frame, not a matrix or an array
Sincerely,
Olena Ageyeva
Windows Live?: Keep your life in sync. Check it out.
_______________________________________________
gov2001-l mailing list
gov2001-l at
lists.fas.harvard.edu
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
Access your email online and on the go with Windows Live Hotmail. Sign up today.
_________________________________________________________________
Windows Live?: Life without walls.
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_allup_1a_explore_032009