```r
plot(y~x)
points(x,fitted(mod),pch=21,bg=2)
arrows(x,fitted(mod),x,y,code=2)
```

<img src="Quantitative_and_Spatial_files/figure-html/unnamed-chunk-138-1.png" width="672" />

```r
dsqrs<-d$residuals^2
dsumsqrs<-sum(dsqrs)
```