[R] Error in predict.lm() for models with no intercept?

Ista Zahn istazahn at gmail.com
Wed Sep 17 00:42:39 CEST 2014


Your example didn't come through, probably because you sent your message in
HTML. Please re send it in plain text (messages sent to this list should
always be plain text, as explained in the posting guide).


        Hi everyone,

        Could there be an error in the predict() function in R for models
without intercepts which include one or more predictors?  When using
the predict() function to obtain the standard errors of the fitted
values produced by a linear model (lm), the behaviour of the standard
errors seems to mirror that of models which include an intercept
(which should not happen).

        Here is an attempt to produce standard errors (and hence confidence
bands) for the fitted values in a linear model with a single predictor
and no intercept using R code:

        ## simulate a response y and two predictors x and z

        [[alternative HTML version deleted]]

R-help at r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

	[[alternative HTML version deleted]]

More information about the R-help mailing list