[R] gamlss() vs glm() standard errors via summary() vs vcov()

1/k^c kch@mberln @ending from gm@il@com
Wed Jul 4 11:08:38 CEST 2018


Hi R-helpers,

I was working with some count data using gamlss() and glm(), and
noticed that the standard errors from the two functions correspond
when extracting from either the model summary for both functions, or
using vcov for both functions, but the standard errors between those
methods do not correspond. I have been lead to believe that in SAS and
Stata, the SEs do correspond between the different methods. Can anyone
assist me in understanding what's different between the two types of
SEs I seem to be encountering when using R with either glm or gamlss?
I feel like I'm missing something obvious. I have included a small
reproducible example below.

library(COUNT) # for myTable()
library(gamlss)
len<-50
seeder<-250
set.seed(seeder)  # reproducible example
dat<-rpois(c(1:len), lambda=2)
myTable(dat)
fac<-gl(n=2, k=1, length=len, labels = c("control","treat"))

# Fit gamlss() and glm() models
fit1<-gamlss(dat~fac, family="PO")
fit2<-glm(dat~fac, family="poisson")

# Extract SEs from model summaries
SESum1<-summary(fit1)[,"Std. Error"]
SESum2<-coef(summary(fit2))[,"Std. Error"]
cbind(SESum1, SESum2) # Corresponds

# Extract SEs via vcov()
SEvcov1<-exp(coef(fit1)) *sqrt(diag(vcov(fit1)))
SEvcov2<-exp(coef(fit2))*sqrt(diag(vcov(fit2)))
cbind(SEvcov1, SEvcov2) # Corresponds

# Compare between summary() and vcov() extraction. Missmatch.
cbind(SESum1, SEvcov1)



More information about the R-help mailing list