2.8 - 2.8 Summary of Important R code
by
The main components of R code used in this chapter follow with components to modify in red, remembering that any R packages mentioned need to be installed and loaded for this code to have a chance of working:
- ◦ Provides numerical summaries of all variables in the data set.
- ◦ Here it is used to fit the reference-coded One-Way ANOVA model with Y as the response variable and X as the grouping variable, storing the estimated model object in MODELNAME.
- ◦ Fits the cell means version of the One-Way ANOVA model.
- ◦ Generates model summary information including the estimated model coefficients, SEs, t-tests, and p-values.
- ◦ Generates the ANOVA table but must only be run on the reference-coded version of the model.
- ◦ Results are incorrect if run on the cell-means model since the reduced model under the null is that the mean of all the observations is 0!
- ◦ Finds the p-value for an observed F-statistic with NUMDF and DENDF degrees of freedom.
- ◦ Generates four diagnostic plots including the Residuals vs Fitted and Normal Q-Q plot.
- ◦ Plots the estimated model.
- ◦ Requires the effects package be loaded.
- ◦ Requires the multcomp package to be installed and loaded.
- ◦ Can only be run on the reference-coded version of the model.
- ◦ Generates the text output and plot for Tukey's HSD as well as the compact letter display.