\begin{Schunk}
\begin{Sinput}
 mod2 <- lm(y ~ xnum1 + xcat2, data = dat)
 anova(mod2, mod1, test = "F")
\end{Sinput}
\begin{Soutput}
Analysis of Variance Table

Model 1: y ~ xnum1 + xcat2
Model 2: y ~ xnum1 + xcat2 + z
  Res.Df    RSS Df Sum of Sq      F  Pr(>F)  
1     97 67.841                              
2     94 61.453  3    6.3877 3.2569 0.02505 *
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
\end{Soutput}
\end{Schunk}
