Displaying 1 result from an estimated 1 matches for "mod_glm2".
Did you mean:
mod_glm
2017 May 02
0
potential bug in simulate.lm when gaussian(link != "identity")
...if you agree that this is a bug)?
Many thanks.
Alex
Simple demonstration:
set.seed(1L)
y <- 10 + rnorm(n = 100)
mean(y) ## 10.10889
var(y) ## 0.8067621
mod_glm1 <- glm(y ~ 1, family = gaussian())
new.y1 <- simulate(mod_glm1)[, 1]
mean(new.y1) ## 10.07493
var(new.y1) ## 0.7402303
mod_glm2 <- glm(y ~ 1, family = gaussian(link = "log"))
new.y2 <- simulate(mod_glm2)[, 1]
mean(new.y2) ## 10.11152
var(new.y2) ## 0.008445062 ##### WRONG #####
mod_glm3 <- mod_glm2
mod_glm3$weights <- NULL
new.y3 <- simulate(mod_glm3)[, 1]
mean(new.y3) ## 10.15524
var(new.y3)...