In the iterative weighted least squares loop of the glm.fit function,
a QR decomposition of the matrix X*sqrt(w) is obtained at each iteration,
using fitted values of the mean response mu from the previous interation.
Here "X" is the design matrix, w = wt*(d(mu)/d(eta))/variance(mu),
"wt" is the vector of weights, and "d(mu)/d(eta)" is the derivative
of mu wrt the linear predictor eta. Upon convergence, the most recent
QR decomposition of X*sqrt(w) is returned and this is later used by
the function summary.glm to compute standard errors.
The QR decomposition being returned by glm.fit uses the fitted values from
parameter estimates at the (final-1)st iteration. But don't we want
fitted values from parameter estimates at the final iteration?
I tried inserting the following lines upon completion of the iterative
weighted least squares loop:
mu.eta.val <- mu.eta(eta)
w <- sqrt((weights[good] * mu.eta.val[good]^2)/variance(mu)[good])
newQR<-qr(x[good, ] * w)
My standard errors based on newQR$qr agree with the standard
errors I had computed manually from the final fits.
Has anyone else encountered this issue? Thanks in advance
for any clarifications.
Brad
--please do not edit the information below--
Version:
platform = i686-pc-linux-gnu
arch = i686
os = linux-gnu
system = i686, linux-gnu
status =
major = 1
minor = 7.0
year = 2003
month = 04
day = 16
language = R
Search Path:
.GlobalEnv, package:methods, package:ctest, package:mva, package:modreg, package:nls, package:ts, Autoloads, package:base
standard errors from glm (PR#3180)
4 messages · mcneney@db.math.sfu.ca, Thomas Lumley, Brian Ripley +1 more
On Wed, 4 Jun 2003 mcneney@db.math.sfu.ca wrote:
The QR decomposition being returned by glm.fit uses the fitted values from parameter estimates at the (final-1)st iteration. But don't we want fitted values from parameter estimates at the final iteration? I tried inserting the following lines upon completion of the iterative weighted least squares loop:
Well, yes, perhaps. OTOH it's a whole lot easier just to tighten the tolerance for convergence, which has been done for 1.7.1 -thomas
On Tue, 3 Jun 2003, Thomas Lumley wrote:
On Wed, 4 Jun 2003 mcneney@db.math.sfu.ca wrote:
The QR decomposition being returned by glm.fit uses the fitted values from parameter estimates at the (final-1)st iteration. But don't we want fitted values from parameter estimates at the final iteration? I tried inserting the following lines upon completion of the iterative weighted least squares loop:
Well, yes, perhaps. OTOH it's a whole lot easier just to tighten the tolerance for convergence, which has been done for 1.7.1
For 1.8.0, in fact.
Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Prof Brian Ripley <ripley@stats.ox.ac.uk> writes:
On Tue, 3 Jun 2003, Thomas Lumley wrote:
On Wed, 4 Jun 2003 mcneney@db.math.sfu.ca wrote:
The QR decomposition being returned by glm.fit uses the fitted values from parameter estimates at the (final-1)st iteration. But don't we want fitted values from parameter estimates at the final iteration? I tried inserting the following lines upon completion of the iterative weighted least squares loop:
Well, yes, perhaps. OTOH it's a whole lot easier just to tighten the tolerance for convergence, which has been done for 1.7.1
For 1.8.0, in fact.
Hmm. Would we want that for 1.7.1 too? There is some use in having output unchanged in the patch series, but not if it is (too) inaccurate, I suppose? BTW, are we sure that tightening convergence criteria also works in the divergent case? Probably not. If the parameter estimate doubles on each iteration, the SEs could be seriously out of whack if they refer to the parameters from last time around (Hauck-Donner effect notwithstanding).
O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907