Visual fitting a line activity.
Load the software:
fetchData("mLineFit.R")
## Retrieving from http://www.mosaic-web.org/go/datasets/mLineFit.R
## [1] TRUE
Then run it:
mLineFit(width ~ length, data = KidsFeet)
Vary the slope and intercept using the sliders.
QUESTIONS:
Fit the model, then construct new data which is the fitted model values plus the residuals shuffled. Fit the same structure of model to the new data. How much do the parameters vary?
Examples:
Do these in the context of a x ~ 1 model. Try different parameters. Use some data with big outliers, e.g. the alder nitrogen fixing variable:
alder = fetchData("alder.csv")
## Retrieving from http://www.mosaic-web.org/go/datasets/alder.csv
densityplot(~SNF, data = alder)
Least absolute value leads to the median, minimax leads to the midpoint.