basic working residuals function - still need to figure out proper ggplot import to make more general
begin documentation