Hi all,
Just a slight tip. To avoid numerical issues, use 0s as your starting
values for 1.2 in the problem set.
--
Patrick Lam
Department of Government and Institute for Quantitative Social Science,
Harvard University
http://www.people.fas.harvard.edu/~plam
Hi,
When generating predicted values in question 1.5, I assume we no longer want
to use a t-distribution with 3 degrees of freedom, since there are more
explanatory variables in this model as compared to the model in 1.3. Is this
right? Do we use a t-dist with 5 d.f.s in question 1.5?
-Eitan
Hi All,
PS 5 has been graded.
Extension School Students: Please see the comments in the problem set 5
drop box for your grade.
Non-Extension School Students: Hard copies of your problem sets will be
handed back today after lecture. They have your grade on them. *This
applies even if you did not submit a paper copy of your problem set*.
See you soon!
Miya
--
Miya Woolfalk
Ph.D. Student
Harvard University
Government and Social Policy
Have anyone figured out what the formula is?
I tried to implement it exactly as it says in the PS, at least as I understood it and I really doubt that it's right.
That is what from my understanding it should look like:
ll.t<-function(par,x,y)
{
delta=par
out<-sum(y*log(pt(x,3, delta))+(1-y)*log(pt(x,3,delta)))
return(out)
}
I have tried x%*%beta instead of x as well and have gotten weird results which did not look right to me.
What am I doing wrong?
I have no studying partner and am really tight on time. Could anyone help please?
Thanks!
Sincerely,
Olena Ageyeva
_________________________________________________________________
Windows Live? Groups: Create an online spot for your favorite groups to meet.
http://windowslive.com/online/groups?ocid=TXT_TAGLM_WL_groups_032009
For the problem set, do not use rocplot() except to check your answers. You
should manually code up and plot the ROC plot.
--
Patrick Lam
Department of Government and Institute for Quantitative Social Science,
Harvard University
http://www.people.fas.harvard.edu/~plam
proportion of 1s correctly classified = # of 1s in data that were predicted
as 1 / # of 1s in data
On Sat, Mar 14, 2009 at 4:47 PM, Kyle Marquardt <marquardtk at gmail.com>wrote:
> Patrick,
>
> Sorry to bother you, but I've been trying to post this question to the
> listserve and it doesn't seem to be working; I'm kind of nervous about
> submitting it again and again so I thought I'd send it to you:
>
> We were looking over Professor King's notes (slide 39 of single equation
> models), and were slightly confused regarding the ROC curve values: is the
> percentage of correctly predicted y values (e.g. correctly predicted 1
> values): 1) correctly predicted 1 values over total number of incidents, 2)
> correctly predicted 1 values over actual number of 1 values, or 3) correctly
> predicted 1 values over predicted number of 1 values?
> Best,
> Kyle
>
--
Patrick Lam
Department of Government and Institute for Quantitative Social Science,
Harvard University
http://www.people.fas.harvard.edu/~plam
I'm pretty sure no one (besides people in the lab) is working on this week's
prob set right now...so tfs this is for you
how do figure out the cdf of a t distribution, do we need a formula? where
is it? how do we find it? this is really hard
help
Hi Folks,
Following up on the comments below (my note from a previous discussion on
the class email list), I wanted to let you all know that I have posted
revised notes for section 5 to the course website. The main thing to note is
that they no longer include the example for calculating the likelihood
confidence interval and comparing the likelihood and Wald based intervals.
Given the re-parametrization in the binomial log likelihood, this code is
incorrect. To get the correct intervals, we need to analytically transform
our estimates back to the original scale.
See you soon!
Best,
Miya
---------- Forwarded message ----------
From: Miya Woolfalk <woolfalk at fas.harvard.edu>
Date: Tue, Mar 10, 2009 at 1:06 AM
Subject: Re: [gov2001-l] EXO 1
To: gov2001-l at lists.fas.harvard.edu
Some clarification:
(1) Yes, MLEs are invariant to re-parameterization (i.e. going from an
bounded to an unbounded and back to an bounded scale when estimating your
parameters). But, measures of uncertainty are not invariant to
re-parameterization. There are two main ways to get your standard errors
(and confidence intervals) back to the original scale after you have
estimated your model by re-parameterizing your parameters. (1) The delta
method -- this is an analytical method to get the variance for our
parameters back to the original scale. Basically, it involves some math to
convert what we know about the distribution of our estimates on the
unbounded scale -- that is that they are distributed N(theta, Var(theta)) --
to get to what we want to know about the distribution of our estimates on
the bounded scale -- that is that they are distributed N(g(theta),
g(var(theta))). (2) The simpler way is to just simulate our parameters. We
will take repeated draws of our parameters from their distribution on the
unbounded scale (i.e. N(theta, sigma.sq) ) and convert each of these draws
back to the bounded scale. We can then simply calculate our standard errors
and confidence intervals by using this simulated sampling distribution.
(2) In PS 5 question 1.2.b, we recommend you use the "L-BFGS-B" method to
get your estimates on the original bounded scale. However, if you are
interested in the delta method, we encourage you to learn it and use it to
answer this question.
Best,
Miya
Aha! Thank you both! Just as I thought: completely overlooked something
fundamental.
Thanks,
R.
On Wed, Mar 11, 2009 at 7:53 PM, <gov2001-l-request at lists.fas.harvard.edu>wrote:
> Send gov2001-l mailing list submissions to
> gov2001-l at lists.fas.harvard.edu
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
> or, via email, send a message with subject or body 'help' to
> gov2001-l-request at lists.fas.harvard.edu
>
> You can reach the person managing the list at
> gov2001-l-owner at lists.fas.harvard.edu
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of gov2001-l digest..."
>
>
> Today's Topics:
>
> 1. Optim vs. Zelig question (Rachel West)
> 2. Re: Optim vs. Zelig question (Brandon Stewart)
> 3. Re: Optim vs. Zelig question (Miya Woolfalk)
> 4. Re: problems with log(exp().... Sequential processing in R
> causing issues (Olena Ageyeva)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 11 Mar 2009 19:44:54 -0400
> From: Rachel West <rwest817 at gmail.com>
> Subject: [gov2001-l] Optim vs. Zelig question
> To: gov2001-l at lists.fas.harvard.edu
> Message-ID:
> <188cad4e0903111644k6ceda0afh3b203441b5641c8d at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi all -
>
> Probably a fundamental misunderstanding on my part here :: but I've
> implemented the logit log-likelihood function as it was derived in the
> lecture slides (to the best of my knowledge), and am attempting to optimize
> the vector of coefficients (beta)......the code gives me an output in the
> proper format (and is consistent for any reasonable starting values for
> "par" in optim), but the output is not in the range of the coefficients
> estimated by Zelig when I use it to check the function.Am I completely
> missing something having to do with constraints or reparametrization here?
> Conceptually, I can't think of what the problem would be, yet I must be
> misunderstanding something here.....right?
>
>
> likelihood.logit <- function(beta, y, X){
> likelihood.logit <- (-1)*sum(log(1+exp((1-2*y)*(X%*%beta))))
> return(likelihood.logit)
> }
>
> beta <- c()
> y <- Incident
> X <- as.matrix(cbind(Temperature, Pressure))
>
> MLE.logit <- optim(par=c(.5,.5), fn=likelihood.logit, y=y, X=X,
> method="BFGS", control=list(fnscale=-1))$par
> MLE.logit
>
>
>
> Many thanks,
> Rachel
>
Hi all -
Probably a fundamental misunderstanding on my part here :: but I've
implemented the logit log-likelihood function as it was derived in the
lecture slides (to the best of my knowledge), and am attempting to optimize
the vector of coefficients (beta)......the code gives me an output in the
proper format (and is consistent for any reasonable starting values for
"par" in optim), but the output is not in the range of the coefficients
estimated by Zelig when I use it to check the function.Am I completely
missing something having to do with constraints or reparametrization here?
Conceptually, I can't think of what the problem would be, yet I must be
misunderstanding something here.....right?
likelihood.logit <- function(beta, y, X){
likelihood.logit <- (-1)*sum(log(1+exp((1-2*y)*(X%*%beta))))
return(likelihood.logit)
}
beta <- c()
y <- Incident
X <- as.matrix(cbind(Temperature, Pressure))
MLE.logit <- optim(par=c(.5,.5), fn=likelihood.logit, y=y, X=X,
method="BFGS", control=list(fnscale=-1))$par
MLE.logit
Many thanks,
Rachel