[R] Simulate residuals with different properties for a linear model (regression)

hadley wickham h.wickham at gmail.com
Tue Jul 21 04:30:55 CEST 2009


> for educational purposes I wonder if it is possible to simulate
> different data sets (or specifically residuals) for a linear regression.
> I would like to show my students residuals with different means,
> variances and distributions (normal, but also not normal) in the plots
> created with the plot command for a lm-object. In addition it would be
> nice to simulate although influencal values (high cooks distance and
> leverage)
>
> lm.results <- lm(y~x,data)
> plot(lm.results)
>
> Is there an easy way to do this? Or can this be done at all (and if yes,
> any hints?:-)

Check out some neat ideas here:
http://www4.stat.ncsu.edu/~stefanski/NSF_Supported/Hidden_Images/stat_res_plots.html

Hadley

-- 
http://had.co.nz/




More information about the R-help mailing list