\begin{Schunk}
\begin{Sinput}
 mymod2 <- lm(y~x+I(x^2)+I(x^3)+I(x^4), data=dat)
 summary(mymod2)
\end{Sinput}
\begin{Soutput}
Call:
lm(formula = y ~ x + I(x^2) + I(x^3) + I(x^4), data = dat)

Residuals:
     Min       1Q   Median       3Q      Max 
-2.67548 -0.74047 -0.03925  0.77174  2.88683 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)    
(Intercept) -1.485342   0.633429  -2.345   0.0211 *  
x           11.319873   0.793773  14.261   <2e-16 ***
I(x^2)      -6.170693   0.324063 -19.042   <2e-16 ***
I(x^3)       1.033545   0.049191  21.011   <2e-16 ***
I(x^4)      -0.053369   0.002442 -21.855   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 1.221 on 95 degrees of freedom
Multiple R-squared:  0.8554,	Adjusted R-squared:  0.8493 
F-statistic: 140.5 on 4 and 95 DF,  p-value: < 2.2e-16
\end{Soutput}
\begin{Sinput}
 newx <- seq(0,10, length.out=100)
 predict2 <- predict(mymod2, newdata=data.frame(x=newx))
 plot(x, y, main = expression(paste("Adding ", x^2, ",", x^3, ", and ", x^4)), pch=16)
 lines(newx,predict2)
\end{Sinput}
\end{Schunk}
