-----Urspr?ngliche Nachricht-----
Von: gov2001-l-bounces(a)lists.fas.harvard.edu
[mailto:gov2001-l-bounces@lists.fas.harvard.edu]
Gesendet: Friday, November 05, 2004 6:48 PM
An: gov2001-l(a)lists.fas.harvard.edu
Betreff: Re: [gov2001-l] running models for subsamples in Zelig
No, I'm saying that there *is* a way to do it, using
z.out <- zelig(onsetnew ~ war + gdpcap, model = "logit",
data = subset(data, gdpcap > 0.2))
I just specify the data as the subset. Or, using your even
better example:
z.out <- zelig(onsetnew ~ war + gdpcap, model = "logit",
data = subset(data, gdpcap > 0.2 & year > 1976))
If you want to do this for multiple subsets, you can define the subsets
outside the zelig() statement and do some checks on them to make
sure that
you have what you want, and then put all the subsets into a list using
data.sets <- list(data1, data2, data3)
for example, and then run the model on each element in the list using
z.out <- list()
for (i in 1:length(data.sets))
z.out[[i]] <- zelig(..., data = data.sets[[i]])
Sound good?
Olivia
----- Original Message -----
From: "Jens Hainmueller" <jens_hainmueller(a)ksg05.harvard.edu>
To: <gov2001-l(a)lists.fas.harvard.edu>
Sent: Friday, November 05, 2004 6:32 PM
Subject: AW: [gov2001-l] running models for subsamples in Zelig
thanks olivia. just to clarify, so you're
saying there is no way to do
something like:
z.out <- zelig(onsetnew ~ war + gdpcap
,model="logit",subset(data,gdpcap>0.2)
or even better:
z.out <- zelig(onsetnew ~ war + gdpcap
,model="logit",subset(data,gdpcap>0.2
& year>1976)
i alwyas have to create the indicator variables (in this case ID=1 if
gdpcap>0.2 and ID=0 if gdpcap<=0.2) outside zelig first and
then use these
subsets in zelig?
best,
jens
> -----Urspr?ngliche Nachricht-----
> Von: gov2001-l-bounces(a)lists.fas.harvard.edu
> [mailto:gov2001-l-bounces@lists.fas.harvard.edu]
> Gesendet: Friday, November 05, 2004 6:27 PM
> An: gov2001-l(a)lists.fas.harvard.edu
> Betreff: Re: [gov2001-l] running models for subsamples in Zelig
>
>
> Good question, Jens.
>
> The example that I did in section with by = "state" is to run the
> same model
> over every state in the data set.
>
> In the example you give below, creating an indicator variable and then
> running the model with by = "indicator" will run the model on
> indicator == 1
> and indicator == 0. If you just want to run the model for
> inidicator == 1,
> you can just use data = subset(mydata, indicator = 1).
>
> If you want to recursively run the model for different subsets,
> create the
> subsets outside of the zelig() statement and then run it in a
loop using
> data = subsets[[i]], for example.
>
> Does this answer your question?
>
> Yours, Olivia
>
> ----- Original Message -----
> From: "Jens Hainmueller" <jens_hainmueller(a)ksg05.harvard.edu>
> To: <gov2001-l(a)lists.fas.harvard.edu>
> Sent: Friday, November 05, 2004 6:13 PM
> Subject: [gov2001-l] running models for subsamples in Zelig
>
>
> > In Zelig, is there a convenient way to run a model for
> different subsets
> > of
> > my data?
> >
> > In the manual this is only discussed for "easy" cases such as run the
> > model:
> > by = state. but what about things like run the model: for
all obs where
> > covariateX >= 0.5 (or even something
like run the model: for all obs
> > for
> > which covariateX=3 & covaraiteV>0.5)
> >
> > Obviously, one way to do this would be to create an
indicator variable
> > like
> > ID=1 if covariateX>=0.5 and ID=0 if covariateX<0.5 and then use
> the usual
> > run the model: by = ID
> >
> > but this is crazy tedious if I want to estimate my model for many
> > different
> > sub samples conditioning on may combinations of specific
values of many
different covariates. is there a more elegant way to
do this?
any help is highly appreciated.
jens
_______________________________________________
gov2001-l mailing list
gov2001-l(a)lists.fas.harvard.edu
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
_______________________________________________
gov2001-l mailing list
gov2001-l(a)lists.fas.harvard.edu
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
_______________________________________________
gov2001-l mailing list
gov2001-l(a)lists.fas.harvard.edu
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
_______________________________________________
gov2001-l mailing list
gov2001-l(a)lists.fas.harvard.edu
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l