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

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


Hi,

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).

Best,
Ista


        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

        x
        [[alternative HTML version deleted]]

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
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