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

isabella at ghement.ca isabella at ghement.ca
Wed Sep 17 00:09:21 CEST 2014


	Hi Antonio,  

	I've just sent an e-mail to the r-help list with some R code which
shows that the standard errors of the fitted values are indeed
computed incorrectly by R (please see below).  Let's hope that there
will be at least one helpful answer to the question.   


 On Tue 16/09/14 3:06 PM , isabella at ghement.ca sent:
	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]]

More information about the R-help mailing list