[R] GLM information matrix
Ravi Varadhan
rvaradhan at jhmi.edu
Fri Sep 29 21:14:50 CEST 2006
David,
You can use the 'vcov' function in the "stats" package to extract the
variance-covariance matrix from the GLM object. Inverse of this matrix will
give you the observed (not Fisher) information matrix.
You can also use the "numDeriv" package to obtain accurate Hessian of the
log-likelihood.
Ravi.
----------------------------------------------------------------------------
-------
Ravi Varadhan, Ph.D.
Assistant Professor, The Center on Aging and Health
Division of Geriatric Medicine and Gerontology
Johns Hopkins University
Ph: (410) 502-2619
Fax: (410) 614-9625
Email: rvaradhan at jhmi.edu
Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html
----------------------------------------------------------------------------
--------
-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Charles Annis, P.E.
Sent: Friday, September 29, 2006 2:51 PM
To: 'Bickel, David'; r-help at stat.math.ethz.ch
Subject: Re: [R] GLM information matrix
David:
I don't have what you want. But if your model is simple (2-parameter,
binomial response, glm with a logit link) I have some code that computes and
plots the loglikelihood surface using contour() and superimposes the
asymptotic 95% confidence ellipse, for comparison with the observed contour
for qchisq(0.95, df=2)/2. And for many datasets the agreement isn't as nice
as you might hope, and that your Hessian might require. (That is, the
actually contour is not elliptical, or if it is its axes may not agree well
with the pseudo-elliptical contour of the observed loglikelihood surface.)
You may be looking for the resulting confidence bounds on the glm fit for
which I also have code that iteratively interrogates the loglikelihood
surface without plotting it.
If any of this is interesting, please send me a note so we won't clog the
bandwidth.
Charles Annis, P.E.
Charles.Annis at StatisticalEngineering.com
phone: 561-352-9699
eFax: 614-455-3265
http://www.StatisticalEngineering.com
-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Bickel, David
Sent: Friday, September 29, 2006 1:50 PM
To: r-help at stat.math.ethz.ch
Subject: [R] GLM information matrix
Is there a function that provides the Fisher information matrix for a
generalized linear model? I do not see how to access the off-diagonal
matrix elements of the value returned by glm. (I'm particularly
interested in logistic regression.)
If not, what is a good way to use R to compute Hessians or other partial
derivatives of log likelihoods?
I would appreciate any guidance.
David
_______________________________________
David R. Bickel http://davidbickel.com
Research Scientist
Pioneer Hi-Bred International (DuPont)
Bioinformatics
7200 NW 62nd Ave.; PO Box 184
Johnston, IA 50131-0184
515-334-4739 Tel
515-334-4473 Fax
david.bickel at pioneer.com
This communication is for use by the intended recipient and ...{{dropped}}
______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list