An embedded and charset-unspecified text was scrubbed... Name: not available Url: https://stat.ethz.ch/pipermail/r-help/attachments/20030518/898e2ef9/attachment.pl
Confidence intervals for gls models?
3 messages · Brown, David, Spencer Graves, Brian Ripley
What about the obvious: tstDf <- data.frame(x=1:9, y=rnorm(9), w=1:9) fit <- lm(y~x, tstDf, weights=w) pred <- predict(fit, se.fit=T) pred$fit + outer(pred$se.fit, c(-2, 2)) "predict.lm" might need weights for interval="prediction" with newdata, but not with interval="confidence" ... or am I missing something? hth. spencer graves
Brown, David wrote:
Is there an easy way to compute confidence intervals (or prediction intervals) for gls models? E.g. for standard linear models, with the predict.lm function, we can set interval="confidence" , level = 0.95 and type="response". Thanks in advance! [[alternate HTML version deleted]]
______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
On Sun, 18 May 2003, Spencer Graves wrote:
What about the obvious: tstDf <- data.frame(x=1:9, y=rnorm(9), w=1:9) fit <- lm(y~x, tstDf, weights=w) pred <- predict(fit, se.fit=T) pred$fit + outer(pred$se.fit, c(-2, 2)) "predict.lm" might need weights for interval="prediction" with newdata, but not with interval="confidence" ... or am I missing something?
That's weighted least squares, not generalized least squares. predict.gls does not have an `se.fit' argument. Howver, lm.gls in package MASS will do the trick at the existing data points. (To predict at newdata you would need to have a model for the covariance matrix, and once you have that you are doing time series or kriging or ... and there are many other possibilities.)
hth. spencer graves Brown, David wrote:
Is there an easy way to compute confidence intervals (or prediction intervals) for gls models? E.g. for standard linear models, with the predict.lm function, we can set interval="confidence" , level = 0.95 and type="response".
Brian D. Ripley, ripley at 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