YOu are not letting the values of "liberal" vary.
Kosuke
On Wed, 2 Apr 2003, Stanislav Markus wrote:
for some reason i'm getting a horizontal line at
pi = 1 with the
following code... i checked my coding of scenarios and it's fine. any
suggestions appreciated. thanks!
plot.2 <- function(X){
pi <- 0
liberal <- dat$ADAACA
par <- reg$coef
for (i in 1:length(liberal)){
x <- as.matrix(X[i,])
pi[i] <- pnorm(par%*%x)
}
plot(liberal, pi)
}
plot.2(X.2)
****************************
Stanislav Markus
Ph.D. Candidate
Harvard University
Department of Government
e: smarkus(a)fas.harvard.edu
t: 617.513.5407
-----Original Message-----
From: Kosuke Imai [mailto:kimai@fas.harvard.edu]
Sent: Tuesday, April 01, 2003 9:43 PM
To: John Bright
Cc: Stanislav Markus; gov2001-l(a)fas.harvard.edu
Subject: Re: [gov2001-l] Re: part a
That's right. X should be a vector, not a matrix, corresponding to a
particular scenario.
Kosuke
On Tue, 1 Apr 2003, John Bright wrote:
I think you want one value for each X_i, so that
X is a kx1 vector.
You get
5000 pi's with 5000 different sets of
parameter estimates for a given
scenario.
John.
On 4/1/03 9:25 PM, "Stanislav Markus" <smarkus(a)fas.harvard.edu> wrote:
> I'm still a bit confused about the calculation of pi values, given
the
> parameter draws: if we do, say, 5000
simulations for 5 parameters,
we'll
> have a 5000x5 matrix. For X, we have a 164x5
matrix. We could
transpose
> X and do:
>
> pi <- pnorm(par.draws%*%t(X))
>
> would that give us pi values? if so, the dimension of pi matrix is
> 5000x164 which is a bit weird.. or not?
>
> Stan
>
>
>
>
> -----Original Message-----
> From: gov2001-l-admin(a)fas.harvard.edu
> [mailto:gov2001-l-admin@fas.harvard.edu] On Behalf Of Kosuke Imai
> Sent: Tuesday, April 01, 2003 4:33 PM
> To: gov2001-l(a)fas.harvard.edu
> Subject: [gov2001-l] Re: part a
>
>
>> From what I understand, the difference between the two graphs we
are
>> supposed to draw in question (a) is
PRESINC. Also, each graph will
> have
>> two curves: one for low probability of DWIN, the other for high
>> probability. Assuming this is correct (?), 2 questions remain:
>
> That's right.
>
>> To separate estimates in the case of incumbency and non-incumbency,
>> should we subset the data, so that PRESINC equals 1 for one subset,
> and
>> 0 or -1 for the other? Following this, should we run two glm probit
>> regressions for each subset? If so, there will be no coefficient
for
>> PRESINC and PRESINC*JULYECQ2 for the
first subset, since PRESINC
> always
>> equals 1 there..
>
> No... You can run one regression and then set the values of
explanatory
> variables according to each senario.
>
>> Should we simulate multiple parameters with mvrnorm() as in HW5,
and
>> then calculate multiple pi-hat values
(to be plotted on the x-axis
in
>> this case)?
>
> Yes, once you do that, you can draw a density plot, which is a
smoothed
version
of histogram (see my solution set to hw5 for the code).
Kosuke
_______________________________________________
gov2001-l mailing list
gov2001-l(a)fas.harvard.edu
http://www.fas.harvard.edu/mailman/listinfo/gov2001-l
_______________________________________________
gov2001-l mailing list
gov2001-l(a)fas.harvard.edu
http://www.fas.harvard.edu/mailman/listinfo/gov2001-l
_______________________________________________
gov2001-l mailing list
gov2001-l(a)fas.harvard.edu
http://www.fas.harvard.edu/mailman/listinfo/gov2001-l
_______________________________________________
gov2001-l mailing list
gov2001-l(a)fas.harvard.edu
http://www.fas.harvard.edu/mailman/listinfo/gov2001-l