Don't forget to add the max value of the likelihood to the quadratic fit.
That will pull the quadratic fit to your lnL function.
-----Original Message-----
From: gov2001-l-bounces at
lists.fas.harvard.edu
[mailto:gov2001-l-bounces at
lists.fas.harvard.edu] On Behalf Of Keith
Schnakenberg
Sent: Thursday, March 13, 2008 12:15 PM
To: gov2001-l at
lists.fas.harvard.edu
Subject: [gov2001-l] quadratic approximation
My quadratic approximation seems to have a maximum near my MLE, but
is vertically way off. I'm not sure if this should matter or not, but
it's not like that in the example so I think it means something has
gone wrong. I was hoping somebody could take a look at my code for
the quadratic approximation and give me some clue as to where I am
going wrong. I have implemented the Fisher information as follows:
fi <- function(par, x=dat$yearsinoffice){
lambda <- par[1]
out <- (-1*(((-1*length(x))/mean(x)^2) + ((2*x +
2*length(x))/mean(x)
^3)))
return(out)
}
I made vectors for plotting the log likelihood (ll) an quadratic
approximation like this:
a <- seq(from = 3, to = 10, by = .01)
out <- c()
for (i in 1:length(a)){
out[i] <- ll(a[i], x=dat$yearsinoffice)
}
out2 <- c()
for (i in 1:length(a)){
out2[i]<- -1/2*fi(mle.num$par, x=dat$yearsinoffice)*(a[i]-mle.num$par)^2
}
This does not seem to cause problems for the maximum value of my
quadratic approximation, but it it makes it far enough off on the y
axis that I can't get them on the same chart. I know the MLE should
not be affected by shifting the thing up and down, but this makes me
suspicious that I've implemented something wrong and my confidence
intervals might be wrong as a result.
_______________________________________________
gov2001-l mailing list
gov2001-l at
lists.fas.harvard.edu
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l