[R] Fitting glm with maxit=0?

David Winsemius dwinsemius at comcast.net
Wed Feb 26 23:55:55 CET 2014


On Feb 26, 2014, at 12:24 AM, Xiaogang Su wrote:

> Dear All,
> 
> Does anyone know if there is any way to obtain the variance-covariance
> matrix for any arbitrarily given estimates with the glm() function?
> 
> Here is what I really want. Given an arbitrary estimate (i.e., as starting
> points with the start= argument), the glm() function could return the
> corresponding variance-covariance matrix (or Hessian) and other quantities
> with no Netwon-Raphson iteration?

Not with an arbitrary start argument. You have offered a counter-example.

> This could have been done by setting
> maxit=0, but very unfortunately that is not an option in glm.control(). To
> illustrate the problem,
> 
> mydata <- read.csv("http://www.ats.ucla.edu/stat/data/binary.csv")
> beta0 <- 1:3
> control0 <- glm.control(epsilon = 1e10, maxit = 0, trace = FALSE)

I admit to curiosity regarding how you interpreted the error message this generates:

Error in glm.control(epsilon = 1e+10, maxit = 0, trace = FALSE) : 
  maximum number of iterations must be > 0

If you fix that problem you will be faced with another one induced by your unrealistic starting values.

-- 
David.

>  fit <- glm(admit ~ gre + gpa, data = mydata, family = "binomial",
> start=beta0, control=control0)
> summary(fit)$"cov.scaled"
> 
> By the way, I am aware that I could directly compute the covariance matrix
> using the formula. I also know that I could extract the corresponding
> deviance by using the offset option.
> 
> Any suggestion is greatly appreicated.
> 
> Thanks,
> Xiaogang Su
> 
> =============================
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org 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.

David Winsemius
Alameda, CA, USA




More information about the R-help mailing list