Dear Kirill,
If pr is a categorical variable, it must take one of the enumerated
values (in your case: U, K, L or J). If you want to calculate first
differences for pr = J, then there are three first differences that
you could calculate:
Pr(Party = 1 | pr = J) - Pr(Party = 1 | pr = U) # Since pr = U, pr cannot
be J
Pr(Party = 1 | pr = J) - Pr(Party = 1 | pr = K)
Pr(Party = 1 | pr = J) - Pr(Party = 1 | pr = L)
Does this make sense? Because there are four levels in pr, there are
4 - 1 first differences that can be calculated.
Yours,
Olivia
On Sat, Jul 4, 2009 at 2:29 AM, Kirill Olegovich
Kalinin<kkalinin(a)umich.edu> wrote:
Hello Olivia,
Thank you for your help! Let?s say I need to find Pr(Party = 1 | pr_J =
0)
- Pr(Party = 1 | pr_J = 1). Is it ok, to write in Zelig
Partisanship.low<- setx(z.out, pr_U=0, pr_K=0, pr_L=0)
Partisanship.high<- setx(z.out, pr_U=1, pr_K=0, pr_L=0) # or pr_K=1 or
pr_L=1 to get pr_J=0
s.out<-sim(z.out, x=Partisanship.high, x1=Partisanship.low)
summary(s.out)
Is this the right logic?
Best,
Kirill.
Quoting Olivia Lau <olivia.lau(a)post.harvard.edu>du>:
Hi, Kirill.
To obtain a first difference, you need to compare the expected value
of Pr(Party = 1 | pr_J = 1) to some other Pr(Party = 1 | ... ). Since
I don't know what you're using for the ..., let's focus on how to
calculate Pr(Party = 1 | pr_J = 1). There are two approaches:
1) The way you have it set up now, category J is the reference
category, such that if pr_U = 0, pr_K = 0, and pr_L = 0, then you can
calculate Pr(Party = 1 | pr_J = 1). In code:
z.out <- zelig(Party ~ Presidentialism + pr_U + pr_K + pr_L,
model = "logit", data=dat).
x.out <- setx(z.out, pr_U = 0, pr_K = 0, pr_L = 0)
s.out <- sim(z.out, x = x.out)
2) When you have a categorical variable in Zelig (or in R, for that
matter), you don't need to separate the variable into indicator
variables as you have done. Let's suppose that a categorical variable
pr has values U, K, L, and J. Then you can do:
z.out <- zelig(Party ~ Presidentialism + as.factor(pr), model =
"logit", data=dat)
x.out <- setx(z.out, as.factor(pr) = "J")
s.out <- sim(z.out, x = x.out)
Best,
Olivia
On Thu, Jul 2, 2009 at 5:27 AM, Kirill Olegovich
Kalinin<kkalinin(a)umich.edu> wrote:
>
> Dear Olivia,
>
> I wonder how, can I compute first differences for the reference
> category,
> using Zelig. Let?s say, I have four dummy variables pr_U, pr_K, pr_L,
> pr_J
> obtained from a single category variable. So after dropping pr_J, I
> run
> the model z.out <- zelig(Party ~ Presidentialism + pr_U + pr_K +
> pr_L,
> model = "logit", data=dat). How do I calculate first difference for
> dropped pr_J?
>
> Thank you for your help!
>
> Best,
> Kirill.
>