title: What standard errors are returned with predict.glm(..., type = "response", se.fit = TRUE)?
body: <p>I am going to fit the model on the data provided in this <a href="https://stackoverflow.com/a/14424417">excellent example</a> on how to compute the 95% confidence interval for the response, after performing a logistic regression:</p>
  
  <pre><code>foo &lt;- mtcars[,c("mpg","vs")]; names(foo) &lt;- c("x","y")
  mod &lt;- glm(y ~ x, data = foo, family = binomial)
  preddata &lt;- with(foo, data.frame(x = seq(min(x), max(x), length = 100)))
  preds &lt;- predict(mod, newdata = preddata, type = "link", se.fit = TRUE)
  
  critval &lt;- 1.96 ## approx 95% CI
  upr &lt;- preds$fit + (critval * preds$se.fit)
  lwr &lt;- preds$fit - (critval * preds$se.fit)
  fit &lt;- preds$fit
  
  fit2 &lt;- mod$family$linkinv(fit)
  upr2 &lt;- mod$family$linkinv(upr)
  lwr2 &lt;- mod$family$linkinv(lwr)
  </code></pre>
  
  <p>Now, my question comes from the fact that you can get the response directly, simply by asking for </p>
  
  <pre><code>predict(..., type = 'response', se.fit = TRUE)
  </code></pre>
  
  <p>without transforming </p>
  
  <pre><code>predict(..., type = 'link', se.fit = TRUE)
  </code></pre>
  
  <p>However, this produces different standard errors. <strong><em>What are these errors and can they be directly used to calculate the confidence interval on the fitted response values?</em></strong></p>
  
  <p>The code in <code>predict.glm</code> that is relevant is this:</p>
  
  <pre><code>switch(type, response = {
      se.fit &lt;- se.fit * abs(family(object)$mu.eta(fit))
      fit &lt;- family(object)$linkinv(fit)
  }, link = , terms = )
  </code></pre>
  
  <p>and comparing outputs:</p>
  
  <pre><code>preds_2 &lt;- predict(mod, newdata = preddata, type = "response", se.fit = TRUE)
  
  
  &gt; head(preds_2$fit)
           1          2          3          4          5          6 
  0.01265744 0.01399994 0.01548261 0.01711957 0.01892627 0.02091959 
  
  &gt; head(preds_2$se.fit)
           1          2          3          4          5          6 
  0.01944681 0.02098841 0.02263473 0.02439022 0.02625902 0.02824491 
  </code></pre>
  
  <p>It doesn't seem very obvious how to go from the above to:</p>
  
  <pre><code>&gt; head(fit2)
           1          2          3          4          5          6 
  0.01265744 0.01399994 0.01548261 0.01711957 0.01892627 0.02091959 
  &gt; head(upr2)
          1         2         3         4         5         6 
  0.2130169 0.2184891 0.2240952 0.2298393 0.2357256 0.2417589 
  &gt; head(lwr2)
             1            2            3            4            5            6 
  0.0006067975 0.0007205942 0.0008555502 0.0010155472 0.0012051633 0.0014297930 
  </code></pre>