====== Least Squares ====== What does "least" mean in "Least Squares"? ===== Animation ===== We want to find an estimate for the slope in 50 candidate slopes, so we just compute the RSS one by one. ===== R Code =====
library(animation)
saveHTML({
    ani.options(interval = 0.3)
    par(mar = c(4, 4, 0.5, 0.1), mgp = c(2, 0.5, 0), tcl = -0.3)
    ## slope changing
    least.squares()
}, img.name = "least_squares", htmlfile = "least_squares.html", 
    ani.height = 450, ani.width = 600, title = "Demonstration of Least Squares (Slope)", 
    description = c("We want to find an estimate for the slope in 50 candidate slopes, so we just compute the RSS one by one. "))

## or with intercept changing
saveHTML({
    ani.options(interval = 0.3)
    par(mar = c(4, 4, 0.5, 0.1), mgp = c(2, 0.5, 0), tcl = -0.3)
    # slope changing
    least.squares(ani.type = "intercept")
}, img.name = "least_squares", htmlfile = "least_squares.html", 
    ani.height = 450, ani.width = 600, title = "Demonstration of Least Squares (Slope)", 
    description = c("We want to find an estimate for the slope in 50 candidate slopes, so we just compute the RSS one by one. "))