[R] Confidence Bands in Polynomial Regression

Dylan Beaudette dylan.beaudette at gmail.com
Tue Jun 16 04:11:36 CEST 2009


On Mon, Jun 15, 2009 at 6:57 PM, Ben Amsel<benamsel at gmail.com> wrote:
>  Hello R users,
>
> Given a linear (in the parameters) regression model where one predictor x
> interacts with time and time*time (ie, a quadratic effect of time t):
> y = b0 + b1(x) + b2(t) + b3(t^2) + b4(x*t) + b5(x*t^2) + e,
>
> I would like to construct 95% confidence bands (optimally, shaded) around
> this function:
>
> *dy* = b1 + b4(t) + b5(t^2)
> *dx*
>
> That is, the partial effect of x on y changing over time t
>
> Is this possible with predict() or perhaps another function?
>
>
> Thank you very much
> Ben

Hi Ben,

Check out the 'Design' package, it has all kinds of convenience
functions for plotting these type of things.

install.packages('Design', dep=TRUE)
?ols

Cheers,
Dylan




More information about the R-help mailing list