Extract estimate of error variance from glm() object
?s 23:29 de 24/12/2024, Bert Gunter escreveu:
... but do note: glm(lot1 ~ log(u), data = clotting, family = gaussian) is a plain old *linear model*, which is of course a specific type of glm, but not one that requires the machinery of glm() to fit. That is, the above is exactly the same as: lm(lot1 ~ log(u), data = clotting) and gives exactly the same sigma() ! (and I would therefore hazard the guess that the poster may misunderstand what a glm actually is, though of course I may be wrong about this). Cheers, Bert On Tue, Dec 24, 2024 at 5:45?AM Christofer Bogaso <bogaso.christofer at gmail.com> wrote:
Hi,
I have below GLM fit
clotting <- data.frame(
u = c(5,10,15,20,30,40,60,80,100),
lot1 = c(118,58,42,35,27,25,21,19,18),
lot2 = c(69,35,26,21,18,16,13,12,12))
summary(glm(lot1 ~ log(u), data = clotting, family = gaussian))
Is there any direct function to extract estimate of Error standard deviation?
______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide https://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide https://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Hello,
In case of doubt, program a residual standard error function and compare
the results.
rse <- function(object) {
rss <- resid(object)^2
sum(rss / object[["df.residual"]]) |> sqrt()
}
clotting <- data.frame(
u = c(5,10,15,20,30,40,60,80,100),
lot1 = c(118,58,42,35,27,25,21,19,18),
lot2 = c(69,35,26,21,18,16,13,12,12))
fit1 <- glm(lot1 ~ log(u), data = clotting, family = gaussian)
fit2 <- lm(lot1 ~ log(u), data = clotting)
# all of the results below are identically equal
sigma(fit1)
rse(fit1)
sigma(fit2)
rse(fit2)
Hope this helps,
Rui Barradas
Este e-mail foi analisado pelo software antiv?rus AVG para verificar a presen?a de v?rus. www.avg.com