\begin{Schunk}
\begin{Sinput}
 res <- persp(x=x1seq,y=x2seq, z=z, zlim=c(-3,3),theta=40, phi=-15)
 mypoints <- trans3d(dat$x1, dat$x2, dat$y, pmat = res)
 points(mypoints, pch =1, col="red")
 vpred <- trans3d(dat$x1, dat$x2, fitted(m1),   pmat=res) 
 vobs <- trans3d(dat$x1, dat$x2, dat$y,   pmat=res) 
 segments(vpred$x, vpred$y, vobs$x, vobs$y, col="red", lty=2)
\end{Sinput}
\end{Schunk}
