3.4: Greenhouse Example in SAS
- Page ID
- 33437
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)
In this section we will modify our previous program for greenhouse data to run the ANOVA model. The two SAS procedures that are commonly used are: proc glm
and proc mixed
.
data greenhouse; input fert $ Height; datalines; Control 21 Control 19.5 Control 22.5 Control 21.5 Control 20.5 Control 21 F1 32 F1 30.5 F1 25 F1 27.5 F1 28 F1 28.6 F2 22.5 F2 26 F2 28 F2 27 F2 26.5 F2 25.2 F3 28 F3 27.5 F3 31 F3 29.5 F3 30 F3 29.2 ; /* Any lines enclosed between starting with "/*" & ending with "*/" will be ignored by SAS. */ /* Recall how to print the data and obtain summary statistics. See section 3.3*/ /*To run the ANOVA model, use proc mixed procedure*/ proc mixed data=greenhouse method=type3 plots=all; class fert; model height=fert; store myresults; /*myresults is an user defined object that stores results*/ title 'ANOVA of Greenhouse Data'; run; /*To conduct the pairwise comparisons using Tukey adjustment*/ /*lsmeans statement below outputs the estimates means, performs the Tukey paired comparisons, plots the data. */ /*Use proc plm procedure for post estimation analysis*/ proc plm restore=myresults; lsmeans fert / adjust=tukey plot=meanplot cl lines; run; /* Testing for contrasts of interest with Bonferroni adjustment*/ proc plm restore=myresults; lsmeans fert / adjust=tukey plot=meanplot cl lines; estimate 'Compare control + F3 with F1 and F2 ' fert 1 -1 -1 1, 'Compare control + F2 with F1' fert 1 -2 1 0/ adjust=bon; run;