Covariance Analysis of Peanut Fertilizer Data using SAS - Prof. Mervyn G. Marasinghe, Study notes of Statistics

An example of how to perform a covariance analysis of peanut fertilizer data using sas. The data is input using the data step, and the proc glm procedure is used to fit a linear model and estimate the covariance matrix. The results are then displayed using proc print and proc gplot.

Typology: Study notes

Pre 2010

Uploaded on 09/02/2009

koofers-user-qwh
koofers-user-qwh 🇺🇸

10 documents

1 / 8

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Example E4
SAS Program
goptions hsize=7.5 in vsize= 5.5 in rotate=landscape targetdevice=pscolor;
data peanuts;
input fertilizer $ yield height;
label fertilizer='Fertilizer' yield='Yield' height='Height';
datalines;
C 12.2 45
C 12.4 52
C 11.9 42
C 11.3 35
C 11.8 40
C 12.1 48
C 13.1 60
C 12.7 61
C 12.4 50
C 11.4 33
S 16.6 63
S 15.8 50
S 16.5 63
S 15.0 33
S 15.4 38
S 15.6 45
S 15.8 50
S 15.8 48
S 16.0 50
S 15.8 49
F 9.5 52
F 9.5 54
F 9.6 58
F 8.8 45
F 9.5 57
F 9.8 62
F 9.1 52
F 10.3 67
F 9.5 55
F 8.5 40
;
run;
proc print data=peanuts;
run;
pf3
pf4
pf5
pf8

Partial preview of the text

Download Covariance Analysis of Peanut Fertilizer Data using SAS - Prof. Mervyn G. Marasinghe and more Study notes Statistics in PDF only on Docsity!

Example E4 SAS Program goptions^ hsize=

7.5^ in^ vsize=

5.5^ in^ rotate=landscape

targetdevice=pscolor;

data^ peanuts;input^ fertilizer $ yield height;label^ fertilizer='Fertilizer'

yield='Yield'

height='Height';

datalines;C^ 12.2^45 C^ 12.4^52 C^ 11.9^42 C^ 11.3^35 C^ 11.8^40 C^ 12.1^48 C^ 13.1^60 C^ 12.7^61 C^ 12.4^50 C^ 11.4^33 S^ 16.6^63 S^ 15.8^50 S^ 16.5^63 S^ 15.0^33 S^ 15.4^38 S^ 15.6^45 S^ 15.8^50 S^ 15.8^48 S^ 16.0^50 S^ 15.8^49 F^ 9.5^52 F^ 9.5^54 F^ 9.6^58 F^ 8.8^45 F^ 9.5^57 F^ 9.8^62 F^ 9.1^52 F^ 10.3^67 F^ 9.5^55 F^ 8.5^40 ; run ; proc^ print^

data=peanuts;

run ;

proc^ glm^ data=peanuts

order=data;

class^ fertilizer;model^ yield = fertilizer height;lsmeans^ fertilizer/stderr

cl^ pdiff;

contrast^ 'Modified vs. Standard'

fertilizer

^1 - .5^ - .5 ;

contrast^ 'Slow-release vs. Fast-release'

fertilizer

^0 1 -^1 ;

title^ 'Covariance Analysis of Peanut Fertilizer Data'; run ; symbol1^ v="C"

cv=red^ f=centb

h=^ 1.5^ i=none;

symbol2^ v="F"

cv=steelblue

f=centb^ h=

1.5^ i=none;

symbol3^ v="S"

cv=magenta

f=centb^ h=

1.5^ i=none;

axis1^ c=dapk

label=(c=blueviolet

h= 1.5^ a=^90

f=centb^ 'Yield');

axis2^ c=dapk

label=(c=blueviolet

h= 1.5^ f=centb

'Height');

proc^ gplot^

data=peanuts;

plot^ yield*height=fertilizer/vaxis=axis

haxis=axis2;

title^ c=darkcyan h=

2 'Covariance Analysis of Peanut Fertilizer Data';

run ;

SAS Output

Covariance^ Analysis

of^ Peanut^ Fertilizer

Data^

Obs^ fertilizer

yield^ height 1 C 12.2^452 C 12.4^523 C 11.9^424 C 11.3^355 C 11.8^406 C 12.1^487 C 13.1^608 C 12.7^619 C 12.4^50 10 C^

11.4^33

11 S^

16.6^63

12 S^

15.8^50

13 S^

16.5^63

14 S^

15.0^33

15 S^

15.4^38

16 S^

15.6^45

17 S^

15.8^50

18 S^

15.8^48

19 S^

16.0^50

20 S^

15.8^49

21 F^

9.5^52

22 F^

9.5^54

23 F^

9.6^58

24 F^

8.8^45

25 F^

9.5^57

26 F^

9.8^62

27 F^

9.1^52

28 F^

10.3^67

29 F^

9.5^55

30 F^

8.5^40

Covariance^ Analysis

of^ Peanut^ Fertilizer

Data^

The^ GLM^ ProcedureClass^ Level^ InformationClass Levels^

Values fertilizer^

3 C^ S^ F

Number^ of^ Observations

Read^30 Number^ of^ Observations

Used^30 Covariance^ Analysis

of^ Peanut^ Fertilizer

Data^

The^ GLM^ Procedure Dependent^ Variable:

yield^ Yield

Sum^ of Source^

DF^ Squares

Mean^ Square

F^ Value^ Pr

>^ F

Model^

4447.85^ <.

Error^

Corrected^ Total^

29 214.7936667R-Square Coeff^ Var^

Root^ MSE^ yield

Mean 0.998055^ 1.

0.^

Source^

DF^ Type^ I^

SS^ Mean^ Square

F^ Value^ Pr

>^ F

fertilizer^

6463.47^ <.

height^

416.62^ <.

Source^

DF^ Type^ III^

SS^ Mean^ Square

F^ Value^ Pr

>^ F

fertilizer^

6657.08^ <.

height^

416.62^ <.

Covariance^ Analysis

of^ Peanut^ Fertilizer

Data^

The^ GLM^ Procedure Dependent^ Variable:

yield^ YieldContrast

DF^ Contrast^

SS^ Mean^ Square

F^ Value^ Pr

>^ F

Modified^ vs.^ Standard

17.62^ 0.

Slow-release^ vs.

Fast-release^

13175.4^ <.

F e r t i l i z e r^

C^ F

S

1 7 1 6 1 5 1 4 1 3 1 2 1 1 1 0^98 3 0^

4 0^

5 0^

6 0^