From alexandre.courtiol at gmail.com  Tue May  9 16:40:46 2017
From: alexandre.courtiol at gmail.com (Alexandre Courtiol)
Date: Tue, 9 May 2017 16:40:46 +0200
Subject: [Rd] Bug simulate.lm() --> needs credential to report it
Message-ID: <CAERMt4dSfb11BJtPSNLEp-O31tkJkuJ5rZzH_4qBfWLR9Y03oQ@mail.gmail.com>

Dear R developers,

I did not get any reply concerning my email from last week concerning the
bug I found in stats::simulate.lm(). The bug shows up when called upon a
GLM with family gaussian(). I am confident it is a genuine bug related to a
mix-up between weights and prior weights that only impacts the gaussian
family (other families have their own simulate functions defined
elsewhere).

I cannot add the bug in Bugzilla as I have no credential.
Could someone please help me to get credentials so that I can add the bug
in bugzilla?

Thanks a lot,

Simple demonstration for the bug:

set.seed(1L)
y <- 10 + rnorm(n = 100)
mean(y) ##  10.10889
var(y)  ##   0.8067621

mod_glm  <- glm(y ~ 1, family = gaussian(link = "log"))
new.y <- simulate(mod_glm)[, 1]
mean(new.y) ## 10.10553
var(new.y)  ##  0.007243695  ##### WRONG #####

mod_glm$weights <- mod_glm$prior.weights  ## ugly hack showing where the
issue is
new.y <- simulate(mod_glm)[, 1]
mean(new.y) ## 10.13554
var(new.y)  ##  0.8629975  ##### OK #####


-- 
Alexandre Courtiol

http://sites.google.com/site/alexandrecourtiol/home

*"Science is the belief in the ignorance of experts"*, R. Feynman

	[[alternative HTML version deleted]]



[Rd] Bug simulate.lm() --> needs credential to report it
Alexandre Courtiol