Lab exercise – 2 Week CRD with one treatment factor

advertisement
CROP 590 Experimental Design in Agriculture
Lab exercise – 2nd Week
CRD with one treatment factor
One-Way Analysis of Variance
SAS On-line Documentation
SAS/STAT– PROC GLM
Notes from your instructor on using SAS 9.3 in CRPS 150
Computers in CRPS 150 currently are running a 64-bit version of SAS 9.3 and a 32-bit
version of Microsoft Office 2013. As a result, we will not be able to use the SAS import wizard to
load Excel files. If you are using a 64-bit version of SAS 9.3 with a 64-bit version of Microsoft
Office on your home or office computer, you should not encounter this problem.
An alternative would be to import space-delimited, comma-separated, or tab-delimited text
files. However, I have encountered another problem with SAS 9.3 that is unrelated to the issue
of compatibility with MS Office. When I use the import wizard to import text files, the width of a
column appears to be defined by the first data value. Any values that come afterwards are
truncated to the same length. We will therefore input data directly in our programs until further
notice.
In SAS 9.3, the default window for output of SAS procedures and analyses is the Results
Viewer. Results are presented in html format. If you prefer the older List (txt) Output format,
you can choose that option by selecting ToolsOptionsPreferences; you then select the
Results Tab and check the box to create a Listing.
One-Way Analysis of Variance
A one-way analysis of variance considers one treatment factor with two or more treatment
levels. The goal of the analysis is to test for differences among the means of the levels and to
quantify these differences.
The following example is adapted from an experiment that was conducted to determine
the relative virulence of three isolates of Rhizoctonia solani on sugar beets. Rhizoctonia solani
causes root rot (damping off) in sugar beet seedlings, which can reduce plant stands. A noninoculated control (check) was also included. The experiment was conducted in a greenhouse
using a Completely Randomized Design (CRD) with five pots per treatment. An equal number of
seeds were planted in each pot and seedling stands were counted.
R99
68
60
79
59
48
R128
123
100
97
118
116
R143
134
129
120
135
109
Check
145
132
141
139
132
These data are stored on the class web site in text file called Lab2.txt. Open this file and
note that each data line has two variables on it. The first is the alphanumeric label for the
isolate and the second is the seedling stand count (STAND). Save this file to your local hard
drive or to your documents folder on the network.
1
1. Open SAS and write the data input statements needed to create the data set ‘beets’:
DATA beets;
INPUT isolate $ stand;
datalines;
Cut and paste the data from Lab2.txt into your program after the datalines statement.
Remember to include a semicolon after your data.
2. Use SAS to run a one-way ANOVA with PROC GLM. PROC GLM can be used for a number of
different designs. PROC GLM performs Analysis of Variance for balanced and unbalanced
data, and can accommodate independent variables that are categorical (class variables) as
well as continuous (as in regression).
You will need a CLASS statement and a MODEL statement that are in their simplest form for
a completely randomized design.
PROC GLM;
CLASS isolate;
MODEL stand = isolate;
RUN;
Add a title statement to your program such as ‘Stand counts of sugar beets’.
The CLASS statement defines the independent variables that occur at predetermined levels
(as compared to a regression analysis, where the independent variables can assume a
continuum of values).
The MODEL statement names the dependent variables and independent effects. As designs
become more complex, so do MODEL statements. Refer to the SAS on-line documentation for
PROC GLM for more details.
MODEL dependents=effects < / options > ;
For ANOVA, the effects that appear in the model will generally be CLASS variables, but there
are exceptions to that rule (for example, if you wanted to include a covariate in the model).
3. Review the output from the ANOVA. What is your null hypothesis? Would you accept or
reject your null hypothesis on the basis of this analysis?
4. If the results of your ANOVA indicate that there are indeed differences between the isolates
of bacteria, have SAS indicate the isolates that are different using LSD. (This is one of the
options that you can specify in PROC GLM).
2
MEANS isolate / LSD;
RUN;
Alternatively, you could obtain confidence intervals for each of the means as an option
with an LSD test.
MEANS isolate / LSD CLM;
RUN;
5. You can output your means to a table that can be viewed in SAS or exported to Excel using
the export wizard (assuming your SAS software is compatible with Excel). You need to
define a name for the data set that will be created (in this case we can use ‘standmeans’).
You will need another means statement, because the ODS output will not be created when
the LSD option is used.
MEANS isolate;
ODS OUTPUT Means=standmeans;
RUN;
Open the data set you have created by selecting “Libraries” and then the “Work” directory
in the Explorer window. Select a data set to open it in a viewtable window.
6. By the end of this lab you should be able to interpret the SAS output you obtained for a
CRD analysis. You should be able to answer the following questions:

Where do I find the MSE on the GLM output?

Why are the SS for the Model and the SS for treatments (isolate) the same?

What does the R-Square value indicate?

How do I determine if the F test for treatments was significant?

How do I interpret output for the LSD test? For example, is the R99 isolate
significantly different than the R128 treatment?

How could I obtain confidence intervals for the treatment means?
3
One-Way Analysis of Variance Using Excel
Note: the Analysis ToolPak may not be available in more recent versions of Excel for Windows.
It is also not available in older versions of Excel for Mac.
7. Cut and paste the data table at the beginning of this document into an Excel spreadsheet.
Use the Excel Data Analysis tool to conduct a single-factor ANOVA. Compare the results to
the output from SAS.
You may have to first add-in the ToolPak if it is not already installed in Excel. The method
for doing this will vary depending on the version of Excel that you are using. For 2013, start
with the FILE tab, and then select the following:
>Excel options
>Add-ins
>Analysis ToolPak
>Manage add-ins
>Go
>Analysis ToolPak
4
Download