Lab 2_2014.doc

advertisement
Lab 2
One way ANOVA In SAS
In SAS for 512 we will essentially learn the data step (putting data in and manipulating data) and the PROC step
(which are procedures in SAS).
First let’s look at the data sets we had in the two tables and see how we can do them in SAS. This is the data on
the three races and their hourly wages.
Inserting data. Remember factor is a categorical and so we need a $ sign.
data race;
input factor $ wage;
cards;
A
5.90
A
5.92
A
5.91
A
5.89
A
5.88
B
5.51
B
5.50
B
5.50
B
5.49
B
5.50
C
5.01
C
5.00
C
4.99
C
4.98
C
5.02
;
run;
Calculate mean, SD and median etc
proc means data=race;
by factor;
var wage;
run;
Running simple ANOVA F test:
proc glm data=race;
class factor;
model wage=factor;
run;
Lab Exercise (turn it in as HW 1 on Wednesday Sept 10 2014)
WRITE the SAS program to do ANOVA for the Data set 2:
I have the data typed in for you. Use it to save time:
5.90
4.42
7.51
7.89
3.78
6.31
3.54
4.73
7.20
5.72
4.52
6.93
4.48
5.55
3.52
A1
A1
A1
A1
A1
B1
B1
B1
B1
B1
C1
C1
C1
C1
C1
In your program MARK or CIRCLE the DATA ENTRY part, the descriptive STATS
part and the ANOVA F test part.
For each of the following scenarios I want you to identify:
1. Factor
2. Level
3. Treatment
4. Response
5. Unit
6. Experimental or Observational Study;
A. A development engineer is interested in determining if varying the cotton content in a synthetic fiber affects the
tensile strength. To do the study he randomly picks 5 swatches of cloths from 5 different types of processes
(with varying amounts of cotton in them). He puts the swatches randomly through a stress test and observes the
tensile strength (the force at which the cloth tears). Here is the data:
% Cotton
15
20
25
30
35
7
12
14
19
7
Observed Tensile Strength
7
15
17
12
18
18
25
22
10
11
11
18
19
19
15
9
18
19
23
11
B.
It is of interest to see if the Soil Electrical Conductivity affects tomato yields. A Study was designed to grow 4
plots of tomato plants at the chosen EC levels of 1.6, 3.8, 6.0, and 10.2 nmhos/cm. The given observations are
tomato yields (kg/plot) for four different levels of electrical conductivity (EC) of the soil.
EC level
1.6
3.8
6.0
10.2
59.5
55.2
51.7
44.6
53.3
59.1
48.8
48.5
Yield
56.8
52.8
53.9
41.0
63.1
54.5
49.0
47.3
Download