You are on page 1of 33

/*

Bi tp
PHN TCH THNG K SINH HC, KHOA HC CY TRNG VI SAS
PGS.TS. L Quang Hng
Ch ng 1
THNG K CN BN V PHN TCH PHNG SAI (ANOVA)
Ngun s liu theo di th nghim
S liu c thu thp, x l v lu t file excel ty theo kiu b tr th nghim. Th d so snh
nng sut (kg/ 20 m2) nm ging ci ngt ln lt l G22, Z15, X31, K14, D25, c th ghi bng
s nghim thc l 1, 2 , 3, 4, 5; hoc ghi tn ging; c b tr th nghim kiu khi y hon
ton ngu nhin (Randomized Complete Block Design) bn khi (I, II, III, IV). Nm nghim
thc th nghim c ghi bng tn ging trong file excel, khi ghi trc, nghim thc ghi sau.
S th nghim
Chiu bin thin
Hng dc cao

II

III 3

IV

9,00
7,59
8,23

9,90

7,00
8,00
11,77
9,12

10,28
10,63
10,15
7,40

10,94
9,99
7,00
10,00

9,86
8,00
9,81
8,00

thp

Cch ghi s liu lu trong file excel


khoi
1
1
1
1
1
2
2
2
2
2
3
3
3
3
3
4
4
4
4
4

nthuc
G22
Z15
X31
K14
D25
G22
Z15
X31
K14
D25
G22
Z15
X31
K14
D25
G22
Z15
X31
K14
D25

nsuat
9.00
10.28
7.00
9.86
10.94
8.00
7.59
8.00
9.99
10.63
7.00
10.15
8.23
11.77
9.81
9.12
10.00
7.40
8.00
9.90

Trnh t nhp s liu c s dng k t n gin v gii thch nh sau:


DATA;
INPUT K $ T $ Y;
CARDS;

1
1
1
1
1
2
2
2
2
2
3
3
3
3
3
4
4
4
4
4

G22
Z15
X31
K14
D25
G22
Z15
X31
K14
D25
G22
Z15
X31
K14
D25
G22
Z15
X31
K14
D25

(DATA: tn d liu, ghi thm tn v kt thc bng du ;)


(INPUT: nhp bin v c k t $ cch khong v du;)
(CARDS: lnh nhp s liu, kt thc bng du;)
(Copy v paste ch c phn s t file excel trn)

9.00
10.28
7.00
9.86
10.94
8.00
7.59
8.00
9.99
10.63
7.00
10.15
8.23
11.77
9.81
9.12
10.00
7.40
8.00
9.90

;
PROC ANOVA;
CLASS K T;
MODEL Y = K T;
MEANS T / LSD ALPHA=0.05;
TITLE NANG SUAT;
RUN;

(du ; cho bit ghi xong s liu)


(X l ANOVA)
(Xp loi cc bin dng x l)
(M hnh bin ph thuc bng ANOVA)
(Xp hng cc trung bnh theo alpha)
(t tn ca ch tiu theo di)
(Lnh x l)

Tm li cc lnh (command, code) phn tch thng k cho cch 1 nh sau:


DATA;
INPUT K $ T $ Y;
CARDS;
.s liu excel

;
PROC ANOVA;
CLASS K T;
MODEL Y = K T;
MEANS T / LSD ALPHA=0.05;
TITLE NANG SUAT THUC THU;
RUN;

Input cch 2 nh sau:


DATA;
INPUT KHOI $ NTHUC $ NSUAT;
CARDS;
.S liu excel

;
PROC ANOVA;
CLASS KHOI NTHUC;
MODEL NSUAT = KHOI NTHUC;
MEANS NTHUC / LSD ALPHA=0.05;
TITLE NANG SUAT THUC THU;
RUN;

* Ghi ch v xp hng cc nghim thc:


2

- Th nghim t hai n nm nghim thc chn so snh Fishers LSD test, ghi:
MEANS NTHUC / LSD; kt qu xp nhm mc nh vi APHA = 0.05; Least Significant
Difference (sai bit nh nht c ngha). Xp nhm mc khc bit p = 0,01 nu ghi ALPHA =
0.01, thng thng l sau khi kim tra kt qu x l ANOVA vi nghim thc c p < 0,01.
- Th nghim t su nghim thc tr ln chn Duncan test (Gomez,1984), ghi:
MEANS NTHUC / DUNCAN; kt qu xp nhm mc nh vi APHA = 0.05 (Trnh Cng
Thnh, 2003). Trc nghim a on Duncan (Duncans Multiple Range Test) xp nhm mc
khc bit p = 0,01 nu ghi ALPHA = 0.01. Duncans Multiple Range Test xp nhm ton th
nghim khi trn bn nghim thc.
Bi tp mu 1: */
DATA;
INPUT K $ T $ Y;
CARDS;

1
1
1
1
1
2
2
2
2
2
3
3
3
3
3
4
4
4
4
4

G22
Z15
X31
K14
D25
G22
Z15
X31
K14
D25
G22
Z15
X31
K14
D25
G22
Z15
X31
K14
D25

9.00
10.28
7.00
9.86
10.94
8.00
7.59
8.00
9.99
10.63
7.00
10.15
8.23
11.77
9.81
9.12
10.00
7.40
8.00
9.90

;
PROC ANOVA;
CLASS K T;
MODEL Y = K T/;
MEANS T / LSD ALPHA=0.05;
TITLE NANG SUAT THUC THU;
RUN;

/* Chng 2
3

PHN TCH PHNG SAI


TH NGHIM B TR HON TON NGU NHIN
(Completely Randomized Design, CRD)
2.1. Th nghim hon ton ngu nhin mt yu t
p dng trong iu kin ng nht v mi trng, dc, nh sng, ph nhiu ca t, b tr
trong phng th nghim, nh li.
Tin li ca phng php ny l cc nghim thc c s ln lp li khc nhau, nhng hn ch l t
chnh xc khi n v th nghim trong nghim thc khng ng nht. khc phc iu ny,
cn tng nhiu s ln lp li v kch thc phi ln, do tn km hn (Clewer, 2001).
2.1.1. Th nghim so snh nng sut cc ging rau hng qu
Th nghim so snh nng sut (kg/) gm su nghim thc l su ging rau hng qu trng
trong nh li, b tr trng theo kiu hon ton ngu nhin, ba ln lp li. p dng x l
ANOVA v so snh vi phng php LSD (Fisher test), Duncan test v Tukey test. Lu sau
x l phi xem hoc sa alpha li cho ph hp vi bng trc nghim ANOVA tnh v x l
li. S liu nhp nh sau:
Bi tp mu 2: */
DATA;
INPUT T $ Y;
CARDS;
S18
12.1
A73
11.2
F21
12.1
G54
14.4
K56
11.8
M39
12.2
S18
13.6
A73
11.1
F21
12.8
G54
14.2
K56
11.1
M39
13.4
S18
12.2
A73
11.6
F21
12.8
G54
14.3
K56
10.8
M39
13.0
;
PROC ANOVA;
CLASS T;
MODEL Y = T;
MEANS T / LSD ALPHA = 0.01;
MEANS T / DUNCAN ALPHA =0.01;
MEANS T / TUKEY ALPHA =0.01;
TITLE NANG SUAT RAU HUNG QUE(TAN/HA);

RUN;

/* 2.1.2. Th nghim lp li khng bng nhau


Th nghim so snh nng sut bp (tn/ha) kiu hon ton ngu nhin vi su ging t A1 n
G6 nhng s ln lp li khng bng nhau (2 v 3 ln). */
DATA;
INPUT T $ Y;
CARDS;
A1
6.7
B2
6.1
C3
6.0
D4
6.2
E5
4.9
G6
6.6
A1
6.8
B2
6.0
C3
5.9
E5
3.5
G6
5.7
A1
6.5
B2
6.1
C3
5.4
D4
4.5
;
PROC anova;
CLASS T;
MODEL Y = T;
MEAN T / DUNCAN ALPHA=0.05;
TITLE CAC LAP LAI KHAC NHAU;
RUN;

/* 2.2. Th nghim hon ton ngu nhin hai yu t


Bi tp th nghim so snh bn lu hunh S v ln P n nng sut cy ci xanh trng trong nh
li. B tr th nghim CRD, hai yu t l S (S1 = khng bn lu hunh, S2 = c bn lu
hunh) v P (P1 = khng bn P, P2 = c bn ln) trn c s 20 m2 v c thit k theo s
nh sau:
P
S

P1
S1 11.5
15.2
S2 13.2
11.2

P2
24.3
28.1
17.5
19.4

Bi tp mu 3: */
5

DATA;
INPUT S $ P $ SP $ Y;
CARDS;
11.5
1
1 S1P1
24.3
1
2 S1P2
15.2
1
1 S1P1
28.1
1
2 S1P2
13.2
2
1 S2P1
17.5
2
2 S2P2
11.2
2
1 S2P1
19.4
2
2 S2P2
;
PROC GLM;
CLASS S P;
MODEL Y = S P S*P/ss3;
MEAN S / LSD ALPHA=0.05;
MEAN P / LSD ALPHA=0.01;
TITLE 2 YEU TO CRD;
RUN;

/* 2.3. Th nghim hon ton ngu nhin ba yu t c tng tc


Th nghim kho st ba yu t gm cht iu ha sinh trng nui cy m: IBA (nng 0,1v
0,5 mg/lt ; BAP (nng 2; 4 v 8 mg/lt) , NAA (nng 0,05; 0,1 v 0,5 mg/lt) nh hng
s chi phong lan. B tr hon ton ngu nhin kiu 3 x 3 x 2 = 18 nghim thc x 3 ln lp li =
54 . K hiu nghim thc l I (IBA), B (BAP), N (NAA).
Nng nhp vo k hiu bin s: IBA.1 l IBA 0,1 mg/lt, BAP2 l BAP 2 mg/lt, NAA.05 l
NAA 0,05 mg/lt.
Mi tm nghim thc c th b tr ngu nhin nh sau
lp li:
T1: I1 B1 N1
T7: I1 B3 N1
T13: I2 B2
T2: I1 B1 N2
T8: I1 B3 N2
T14: I2 B2
T3: I1 B1 N3
T9: I1 B3 N3
T15: I2 B2
T4: I1 B2 N1
T10: I2 B1 N1
T16: I2 B3
T5: I1 B2 N2
T11: I2 B1 N2
T17: I2 B3
T6: I1 B2 N3
T12: I2 B1 N3
T18: I2 B3

cho 1 ln
N1
N2
N3
N1
N2
N3

S th nghim kiu hon ton ngu nhin 3 ln lp li:


I1
I2
I1
I1
I2
I1
I2

B2
B1
B3
B1
B1
B3
B1

N2
N1
N1
N1
N3
N3
N3

I1
I2
I2
I1
I2
I2
I2

B1
B1
B2
B1
B2
B1
B2

N1
N3
N3
N2
N2
N2
N2

I2
I2
I1
I1
I2
I2
I1

B2
B2
B3
B2
B3
B3
B2

N2
N1
N3
N2
N2
N3
N2

I1
I2
I1
I1
I2
I1
I1

B1
B1
B2
B2
B1
B3
B3

N2
N2
N1
N3
N1
N2
N3

I2
I1
I2
I2
I1
I1
I1

B3
B3
B3
B2
B2
B1
B3

N2
N2
N3
N3
N1
N3
N1

I1
I2
I1
I2
I1
I2
I2

B2
B3
B1
B3
B3
B2
B1

N3
N1
N3
N1
N1
N1
N2
6

I1 B1 N2
I1 B2 N3

I2 B3 N2
I2 B1 N1

I2 B2 N1
I1 B1 N1

I2 B2 N3
I1 B1 N3

I2 B3 N1
I1 B2 N1

I1 B3 N2
I2 B3 N3

* Ghi ch : IBABAPNAA$25. l cc bin c vit thnh 1 t c khong 25 k t in


ra bng kt qu x l.

Bi tp mu 4: */
DATA;
input IBA BAP NAA Y IBABAPNAA$25.;
CARDS;
0.1
2
0.05
21
0.1
2
0.1
23
0.1
2
0.5
18
0.1
4
0.05
14
0.1
4
0.1
12
0.1
4
0.5
6
0.1
8
0.05
17
0.1
8
0.1
11
0.1
8
0.5
13
0.1
2
0.05
19
0.1
2
0.1
24
0.1
2
0.5
19
0.1
4
0.05
13
0.1
4
0.1
13
0.1
4
0.5
7
0.1
8
0.05
17
0.1
8
0.1
10
0.1
8
0.5
14
0.1
2
0.05
21
0.1
2
0.1
25
0.1
2
0.5
19
0.1
4
0.05
12
0.1
4
0.1
13
0.1
4
0.5
8
0.1
8
0.05
19
0.1
8
0.1
11
0.1
8
0.5
12
0.2
2
0.05
19
0.2
2
0.1
24
0.2
2
0.5
20
0.2
4
0.05
11
0.2
4
0.1
10
0.2
4
0.5
5
0.2
8
0.05
18
0.2
8
0.1
10
0.2
8
0.5
14
0.2
2
0.05
20
0.2
2
0.1
23
0.2
2
0.5
18
0.2
4
0.05
12
0.2
4
0.1
11
0.2
4
0.5
6

IBA.1BAP2NAA.05
IBA.1BAP2NAA.1
IBA.1BAP2NAA.5
IBA.1BAP4NAA.05
IBA.1BAP4NAA.1
IBA.1BAP4NAA.5
IBA.1BAP8NAA.05
IBA.1BAP8NAA.1
IBA.1BAP8NAA.5
IBA.1BAP2NAA.05
IBA.1BAP2NAA.1
IBA.1BAP2NAA.5
IBA.1BAP4NAA.05
IBA.1BAP4NAA.1
IBA.1BAP4NAA.5
IBA.1BAP8NAA.05
IBA.1BAP8NAA.1
IBA.1BAP8NAA.5
IBA.1BAP2NAA.05
IBA.1BAP2NAA.1
IBA.1BAP2NAA.5
IBA.1BAP4NAA.05
IBA.1BAP4NAA.1
IBA.1BAP4NAA.5
IBA.1BAP8NAA.05
IBA.1BAP8NAA.1
IBA.1BAP8NAA.5
IBA.2BAP2NAA.05
IBA.2BAP2NAA.1
IBA.2BAP2NAA.5
IBA.2BAP4NAA.05
IBA.2BAP4NAA.1
IBA.2BAP4NAA.5
IBA.2BAP8NAA.05
IBA.2BAP8NAA.1
IBA.2BAP8NAA.5
IBA.2BAP2NAA.05
IBA.2BAP2NAA.1
IBA.2BAP2NAA.5
IBA.2BAP4NAA.05
IBA.2BAP4NAA.1
IBA.2BAP4NAA.5

0.2
0.2
0.2
0.2
0.2
0.2
0.2
0.2
0.2
0.2
0.2
0.2

8
8
8
2
2
2
4
4
4
8
8
8

0.05
0.1
0.5
0.05
0.1
0.5
0.05
0.1
0.5
0.05
0.1
0.5

IBA.2BAP8NAA.05
IBA.2BAP8NAA.1
IBA.2BAP8NAA.5
IBA.2BAP2NAA.05
IBA.2BAP2NAA.1
IBA.2BAP2NAA.5
IBA.2BAP4NAA.05
IBA.2BAP4NAA.1
IBA.2BAP4NAA.5
IBA.2BAP8NAA.05
IBA.2BAP8NAA.1
IBA.2BAP8NAA.5

15
12
16
20
24
18
13
12
8
8
12
14

;
PROC GLM;
CLASS IBA BAP NAA;
MODEL Y = IBA|BAP|NAA/ss3;
MEANS IBA|BAP|NAA / LSD ALPHA=0.01;
LSMEANS BAP*NAA / PDIFF=CONTROL ADJUST=DUNNETT;
LSMEANS IBA*BAP*NAA / PDIFF=CONTROL ADJUST=DUNNETT;
TITLE SO CHOI LAN;
RUN;
PROC GLM;
CLASS IBABAPNAA;
MODEL Y = IBABAPNAA/ss3;
MEANS IBABAPNAA / DUNCAN ALPHA=0.05;
RUN;

/* Chng 3
PHN TCH PHNG SAI
TH NGHIM KHI Y NGU NHIN
(Randomized Complete Block Design, RCBD)
3.1. Khi y hon ton ngu nhin mt yu t
y l kiu b tr ph bin nht trong nghin cu th nghim, c p dng u tin so vi cc
cch b tr khc. p dng cho vic so snh cc ging, loi phn bn trong iu kin t ai,
ngoi cnh tng i t ng nht. Thng c chiu bin thin ca hng dc hoc hng nh
sng, ph t, pH, cn iu chnh ph hp v kch thc, chiu di . Kiu RCBD gim sai
s th nghim, nhng chu nh hng ca khi.
Th nghim so snh nng sut ht u phng 9% m (kg/ 20m2) ca 5 ging trong 3
khi.
B tr th nghim theo khi y hon ton ngu nhin, ba ln lp li, 5 nghim thc gm 5
ging l ging L v cc ging tuyn chn. Tng s = 3 x 5 = 15 (k = khi; t = nghim
thc, tn ging; y = nng sut). S th nghim nh sau:
Hng dc cao

I
II
III

L9801-10
VD2
VD99-3

Ly
VD1
VD2

VD2
VD99-3
VD1

VD99-3
Ly
L9801-10

VD1
L9801-10
Ly

Thp

Bi tp mu 5: */
data;
input k $ t $ y;
cards;
1
1
1
1
1
2
2
2
2
2
3
3
3
3
3

VD1
VD2
Ly
VD99-3
L9801-10
VD1
VD2
Ly
VD99-3
L9801-10
VD1
VD2
Ly
VD99-3
L9801-10

3.39
3.64
4.36
3.29
3.05
3.25
4.07
3.64
2.87
3.19
3.74
4.17
3.73
3.17
3.55

;
proc anova;
class k t;
model y = k t;
means t /duncan alpha=0.05;
title 'Thi nghiem 1 yeu to RCBD';
run;

/*3.2. Kiu vung la tinh (Latin square)


p dng khi c bin thin hai chiu ca cc nghim thc v cn c kho st theo hai hng,
thng l b tr theo hng v ct. Bi tp th nghim kho st tng gim chiu cao la m theo
tiu chun do my gt trn su l. Th t (I, II, III, IV, V, VI) trn cc khu vc A, B, C, D, E,
F (s liu trch t Barnard, 1994). Chiu cao chi so snh vi chiu cao thc s (cm).
Khu vc
I
II
III
IV
V
VI

f
b
c
d
e
a

b
f
e
c
a
d

a
d
f
b
c
e

d
a
b
e
f
c

c
e
d
a
b
f

e
c
a
f
d
b

D liu c sp xp nh sau: hng (H), ct (C), nghim thc (T) v chiu cao (Y).

Bi tp mu 6: */
DATA;

INPUT H C T $ Y;
CARDS;
1
1
1
1
1
1
2
2
2
2
2
2
3
3
3
3
3
3
4
4
4
4
4
4
5
5
5
5
5
5
6
6
6
6
6
6

1
2
3
4
5
6
1
2
3
4
5
6
1
2
3
4
5
6
1
2
3
4
5
6
1
2
3
4
5
6
1
2
3
4
5
6

f
b
a
d
c
e
b
f
d
a
e
c
c
e
f
b
d
a
d
c
b
e
a
f
e
a
c
f
b
d
a
d
e
c
f
b

3.5
4.2
6.7
6.6
4.1
3.8
8.9
1.9
5.8
4.5
2.4
5.8
9.6
3.7
-2.7
3.7
6
7
10.5
10.2
4.6
3.7
5.1
3.8
3.1
7.2
4
-3.3
3.5
5
5.9
7.6
-0.7
3
4
8.6

;
PROC ANOVA;
CLASS H C T;
MODEL Y = H C T;
MEANS T / DUNCAN ALPHA=0.01;
TITLE CHIEU CAO LUA MI;
RUN;

/* 3.3. Khi y ngu nhin hai yu t c tng tc (interaction)


Kiu th nghim cn bn ny thc hin tm tc ng ng thi ca hai yu t cn kho st.
Th nghim hai yu t, yu t A c ba nghim thc, yu t B c nm nghim thc
Th nghim b tr trn ba khi y ngu nhin, kho st nng sut ci du Y (kg/) do nh
hng ba nng cht iu ha sinh trng (S1, S2, S3) v nm lng m (D1, D2, D3, D4,
D5), s liu trch dn trang 168 ca Clewer (2001).
10

C hai bc: (1) x l ANOVA bng PROC GLM (General Linear Model), xp nhm cc
nghim thc ca yu t S, D. So snh tng tc LSMEAN bng: LSMEANS S*D/PDIFF
ADJUST=DUNNETT; (2) tnh khc bit tng tc ca yu t S*D da trn so snh gi tr xc sut
iu chnh (adjust p-values) ca PDIFF ADJUST=DUNNETT.
File mu x l ANOVA v xp nhm cc nghim thc ca yu t S v D m ha bng s.
* Lu s dng du $ cch cc bin s. M ha bng ch vi khi (K), nng cht iu
ha sinh trng (S) v lng m (D), nng sut ci du Y (kg/).
Bi tp mu 7: */
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3

1
1
1
1
1
2
2
2
2
2
3
3
3
3
3
1
1
1
1
1
2
2
2
2
2
3
3
3
3
3
1
1
1
1
1
2
2
2
2
2
3
3
3
3
3

1
2
3
4
5
1
2
3
4
5
1
2
3
4
5
1
2
3
4
5
1
2
3
4
5
1
2
3
4
5
1
2
3
4
5
1
2
3
4
5
1
2
3
4
5

S1D1
S1D2
S1D3
S1D4
S1D5
S2D1
S2D2
S2D3
S2D4
S2D5
S3D1
S3D2
S3D3
S3D4
S3D5
S1D1
S1D2
S1D3
S1D4
S1D5
S2D1
S2D2
S2D3
S2D4
S2D5
S3D1
S3D2
S3D3
S3D4
S3D5
S1D1
S1D2
S1D3
S1D4
S1D5
S2D1
S2D2
S2D3
S2D4
S2D5
S3D1
S3D2
S3D3
S3D4
S3D5

0.9
1.2
1.3
1.8
1.1
0.9
1.1
1.3
1.6
1.9
0.9
1.4
1.3
1.4
1.2
0.9
1.3
1.5
1.9
1.4
0.8
0.9
1.5
1.3
1.6
1
1.2
1.4
1.5
1.1
1
1.2
1.4
2.1
1.2
0.8
0.9
1.1
1.1
1.5
0.7
1
1.4
1.4
1.3

DATA;
INPUT K $ S $ D $ SD $ Y;
CARDS;
;
PROC GLM;
CLASS K S D;
MODEL Y = K S D S*D/ss3;
MEAN S/LSD;
MEAN D/LSD ALPHA=0.01;
MEAN S*D/ DUNCAN ALPHA=0.01;
LSMEANS S*D / PDIFF ADJUST=DUNNETT
ALPHA=0.01;
TITLE RCBD 2 YEU TO;

RUN;

PROC GLM;
CLASS K SD;
MODEL Y = K SD/ss3;
MEAN SD / DUNCAN ALPHA=0.01;
RUN;

/* 3.4. Th nghim l ph (Split plot) c


tng tc (interaction)
Th nghim kt hp cc nghim thc thnh
nhm trong mt yu t l chnh gi l kiu th
nghim l ph (split plot design). Ty cch
chn yu t no l chnh hay ph, nhng p
dng ph bin nht vi yu t A thng l l
chnh (main plot factor) hay l l ln (large
plots) nh cy t, ti nc; l ph B (subplot
factor) hay l l nh (small plots) nh phn bn,
ging (Clewer, 2001). Yu t A v B c b
tr hon ton ngu nhin, yu t B xp theo l
ph c xem nh l yu t kho st so vi
cc gi tr trung bnh trong nh hng ca
tng tc khi vi yu t A (K*A), tnh
tng tc ca tt c cc l. Tng tc ca l
11

ph c so snh vi sai s th nghim residual (SAS, 1999).


Phi c test gi thit: TEST H = A
E = K*A; (gi thit null, khng khc
nhau).
S th nghim chung nh sau:
K2

Khi I
K1
K3

K1

Khi II
K2
K3

V2

V4

V4

Khi III
K3
K2

K1

V1

V4

V2

V4

V1

V4

V3

V2

V3

V1

V3

V1

V3

V3

V1

V3

V1

V4

V3

V1

V2

V2

V1

V2

V1

V3

V2

V2

V4

V3

V4

V2

V4

Th nghim kho st nng sut u bp (tn/ha) do yu t khong cch trng v ging.


Khong cch v ging c th s dng m ha bng ch s v nguyn tn ging.
Bi tp s dng m ha bng ch s nh sau:
Yu t K l chnh: ba nghim thc v khong cch: K1, K2, K3.
Yu t V l ph: bn ging l V1, V2, V3, V4. Yu t KV: yu t tng tc ca hai yu t K v
V.
B tr th nghim trn ba khi y , ngu nhin (KHI: 1, 2, 3).
Bi tp mu 8: */
Data;
Input KHOI $ K $ V $ KV $ Y;
cards;
1
1

1
1

1
2

K1V1
K1V2

6.89
6.78

1
1
2
2
2
2
3
3
3
3
1
1
1
1

1
1
1
1
1
1
1
1
1
1
2
2
2
2

3
4
1
2
3
4
1
2
3
4
1
2
3
4

K1V3
K1V4
K1V1
K1V2
K1V3
K1V4
K1V1
K1V2
K1V3
K1V4
K2V1
K2V2
K2V3
K2V4

6.89
7.34
6.43
6.89
7.10
7.50
6.71
7.05
7.45
7.52
8.82
9.51
7.81
7.95

12

2
2
2
2
3
3
3
3
1
1
1
1
2
2
2
2

2
2
2
2
2
2
2
2
3
3
3
3
3
3
3
3

1
2
3
4
1
2
3
4
1
2
3
4
1
2
3
4

K2V1
K2V2
K2V3
K2V4
K2V1
K2V2
K2V3
K2V4
K3V1
K3V2
K3V3
K3V4
K3V1
K3V2
K3V3
K3V4

8.75
9.64
8.71
6.96
8.87
9.55
9.80
7.94
10.35
11.96
10.46
10.91
10.39
11.78
10.32
10.97

3
3
3
3

3
3
3
3

1
2
3
4

K3V1
K3V2
K3V3
K3V4

10.57
10.81
10.67
11.45

;
proc glm;
class KHOI K V;
model Y = KHOI K KHOI*K V K*V/ss3;
test h=K e=KHOI*K;
means K V K*V/lsd alpha=0.05;
lsmeans K*V/pdiff=control adjust=dunnett;

title nang suat lo phu tuong tac dunnett;


run;
proc glm;
class KHOI KV;
model Y = KHOI KV/ss3;
means KV/Duncan alpha=0.05;
run;

/* 3.5. Th nghim l sc (strip plot)


Th nghim b tr c mt yu t gm mt dy cc c s trong mt khi theo mt hng trong
khi, v yu t th hai cng gm mt dy cc c s theo mt hng khc trong khi.
Nh vy c mt yu t theo hng dc (vertical) v yu t th hai theo hng ngang
(horizontal). Cc c s trong khi c b tr ngu nhin. Strip plot vi b tr c bit theo
sc cn gi l split-block design. Th nghim p dng cho c s ln v lin tc, v c s nh
kh thc hin.
Cn trc nghim gi thit nh hng ca khi vi yu t A, nh hng ca khi vi yu t B.
test h=A e=KHOI*A;
test h=B e=KHOI*B;
13

Bi tp: th nghim b tr khi (KHOI) RCBD tnh nng sut la mch Y (kg/ c s) lm
thc n gia sc, bn phn kali (K) c ba nghim thc : K1 = 0 kg/ha, K2 = 25 kg/ha v K3 = 50
kg/ha. Phn ln (P) c hai nghim thc: P1 = 25 kg/ha, P2 = 50 kg/ha. Bn K chy dc ht ba .
Trn cc bn K, bn P chy ngang theo gc thng (s liu trch t Petersen, 1994).
S th nghim nh sau:
P1
P2

K3 K1
56
32
67
54
Khi 1

K2
49
58

P2
P1

K1
K3
38
62
52
72
Khi 2

K2
50
64

P2
P1

K2
K1
54
44
63
54
Khi 3

K3
51
68

Bi tp mu 9: */
data;
input KHOI $ K $ P $ Y;
cards;
1
1
1
32
1
1
2
54
1
2
1
49
1
2
2
58
1
3
1
56
1
3
2
67
2
1
1
38
2
1
2
52
2
2
1
50
2
2
2
64
2
3
1
62
2
3
2
72
3
1
1
44
3
1
2
54
3
2
1
54
3
2
2
63
3
3
1
51
3
3
2
68
;
proc glm;
class KHOI K P;
model Y = KHOI K KHOI*K P KHOI*P K*P/ss3;
test h=K e=KHOI*K;
test h=P e=KHOI*P;
means K P K*P/lsd alpha=0.01;
lsmeans K/pdiff adjust=dunnett alpha=0.01;

titleSTRIP PLOT P 142;


run;

/* 3.6. Th nghim l ph ca l ph (Split Split Plot)


14

Th nghim c b tr khi thc hin ng nht mt k thut trn l ln, in hnh l cc


nghim thc trong l ln A (main plot treatments) nh khong cch trng, l ph B (sub-plot
treatments) vi cc nghim thc nh ging, v l ph ca l ph C (sub-sub plot treatments) nh
cc lng N (Kumar, 2008).
Bi tp vi th nghim kho st 3 loi phn bn n nng sut ht u phng 9% m ht,
c b tr l ln A (whole plot factor) c 3 lng m N, trong l ph B l 2 lng ln
(intermediate size plot, subplot factor) v trong c l ph ca l ph nh nht C l 3 lng K
(sub-subplot factor),. Tt c cho 1 ln lp li (khi) c 3 x 2 x 3 = 18 . B tr ngu nhin cho
tng yu t t l A n l C, 4 ln lp li l 4 khi. B tr t tri sang phi theo s cho khi 1
nh sau:
KHI 1
A1B1C2
A1B2C1
A3B2C3
A3B1C2
A2B2C1
A2B1C3

A1B1C1
A1B2C3
A3B2C2
A3B1C3
A2B2C3
A2B1C2

A1B1C3
A1B2C2
A3B2C1
A3B1C1
A2B2C2
A2B1C1

S liu c ghi theo lnh x l v bng s. K hiu l K:


khi, cc yu t A, B, C v nng sut Y (tn/ha).
Bi tp mu 10: */
DATA;
input K A B C $ Y;
CARDS;
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
2
1
2
1
2
1
2
1
2
1
3
1
3
1
3
1
3
1
3
1
3
2
1

1
1
1
2
2
2
1
1
1
2
2
2
1
1
1
2
2
2
1

1
2
3
1
2
3
1
2
3
1
2
3
1
2
3
1
2
3
1

1.19
1.59
1.83
1.39
1.90
2.01
1.45
1.88
1.92
1.90
1.85
2.21
1.17
1.27
1.49
1.04
1.45
1.83
1.27

15

2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4

1
1
1
1
1
2
2
2
2
2
2
3
3
3
3
3
3
1
1
1
1
1
1
2
2
2
2
2
2
3
3
3
3
3
3
1
1
1
1
1
1
2
2
2
2
2
2
3
3
3

1
1
2
2
2
1
1
1
2
2
2
1
1
1
2
2
2
1
1
1
2
2
2
1
1
1
2
2
2
1
1
1
2
2
2
1
1
1
2
2
2
1
1
1
2
2
2
1
1
1

2
3
1
2
3
1
2
3
1
2
3
1
2
3
1
2
3
1
2
3
1
2
3
1
2
3
1
2
3
1
2
3
1
2
3
1
2
3
1
2
3
1
2
3
1
2
3
1
2
3

1.48
1.86
1.52
2.01
2.18
1.24
1.58
1.63
1.55
1.60
2.18
1.21
1.39
1.50
1.15
1.60
1.89
1.19
1.44
1.46
1.51
1.53
2.03
1.39
1.55
1.36
1.48
1.58
1.95
1.06
1.19
1.22
1.26
1.33
1.44
1.20
1.32
1.19
1.36
1.55
2.14
1.17
1.39
1.43
1.44
1.50
1.88
1.05
1.22
1.19

16

4
4
4

3
3
3

2
2
2

1
2
3

1.16
1.56
2.01

;
PROC GLM;
CLASS K A B C;
MODEL Y = K A K*A
B A*B K*A*B
C A*C B*C A*B*C/ss3;
TEST H=A
E=K*A;
TEST H=B
E=K*A*B;
TEST H=A*B E=K*A*B;
MEANS A B C A*B A*C A*B*C/LSD ALPHA=0.01;
LSMEANS A*B / PDIFF=CONTROL ADJUST=DUNNETT;
LSMEANS B*C / PDIFF=CONTROL ADJUST=DUNNETT;
TITLE SPLIT SPLIT PLOT;
RUN;

/* 3.7. Th nghim l ph ca l sc (Strip Split Plot)


Th nghim kho st nng sut ci xanh nh hng do khong cch trng v lng phn bn
m (N), cn thc hin trn l ln v lin tc, bn ln lp li.
Trong khi 1 (lp li 1), hai khong cch c b tr theo l sc ng (vertical strip), trong
bn ging b tr ngu nhin l ph trong mt l lng phn bn N. Lng N b tr l sc ngang
(horizonal strip) qua cc l ph (SAS, 2004).
Cc yu t gm: khong cch c hai loi (kcach1, kcach2), ging c 4 ging (giong1, giong2,
giong3, giong4), lng m c 3 mc (luongN1, luongN2, luongN3), ba khi (ln lp li: khoi
1, 2, 3) v nng sut ci xanh (y).
S b tr th nghim cho 1 khi nh sau:
KHI I
Kcach1
LuongN1
LuongN3
LuongN2

giong1
giong2
giong3

Kcach2

giong3 giong2 giong4 giong3 giong2 giong1 giong4


giong4 giong3 giong1 giong2 giong1 giong4 giong3
giong2 giong1 giong4 giong4 giong3 giong2 giong1

S liu c ghi nh bng sau, lu yu t kcNgiong l xp hng cc nghim thc trong


tng tc ca khong cch, lng m v ging; nhng khng c khc bit thng k theo bng
17

ANOVA, nhng dng cc tr s ghi v bng kt qu. Ch c tng tc khong cch v


ging v vy cn so snh Dunnett hai yu t ny. Cu lnh ghi nh sau:
lsmeans kcach*giong / pdiff=control adjust=dunnett;
Bi tp mu 1: */

Data;
Input khoi $ kcach $ luongN $ giong $ kcNgiong $ y;
Cards;
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

1
1
1
1
1
1
1
1
1
1
1
1
2
2
2

1
1
1
1
2
2
2
2
3
3
3
3
1
1
1

1
2
3
4
1
2
3
4
1
2
3
4
1
2
3

KC1N1G1
KC1N1G2
KC1N1G3
KC1N1G4
KC1N2G1
KC1N2G2
KC1N2G3
KC1N2G4
KC1N3G1
KC1N3G2
KC1N3G3
KC1N3G4
KC2N1G1
KC2N1G2
KC2N1G3

11
18
12
14
13
16
15
12
11
19
12
14
13
15
11

1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2

2
2
2
2
2
2
2
2
2
1
1
1
1
1
1
1
1
1
1

1
2
2
2
2
3
3
3
3
1
1
1
1
2
2
2
2
3
3

4
1
2
3
4
1
2
3
4
1
2
3
4
1
2
3
4
1
2

KC2N1G4
KC2N2G1
KC2N2G2
KC2N2G3
KC2N2G4
KC2N3G1
KC2N3G2
KC2N3G3
KC2N3G4
KC1N1G1
KC1N1G2
KC1N1G3
KC1N1G4
KC1N2G1
KC1N2G2
KC1N2G3
KC1N2G4
KC1N3G1
KC1N3G2

10
9
18
12
15
14
16
16
12
15
15
9
10
11
17
13
12
11
19

18

2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3

1
1
2
2
2
2
2
2
2
2
2
2
2
2
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2

3
3
1
1
1
1
2
2
2
2
3
3
3
3
1
1
1
1
2
2
2
2
3
3
3
3
1
1
1
1
2
2
2

3
4
1
2
3
4
1
2
3
4
1
2
3
4
1
2
3
4
1
2
3
4
1
2
3
4
1
2
3
4
1
2
3

KC1N3G3
KC1N3G4
KC2N1G1
KC2N1G2
KC2N1G3
KC2N1G4
KC2N2G1
KC2N2G2
KC2N2G3
KC2N2G4
KC2N3G1
KC2N3G2
KC2N3G3
KC2N3G4
KC1N1G1
KC1N1G2
KC1N1G3
KC1N1G4
KC1N2G1
KC1N2G2
KC1N2G3
KC1N2G4
KC1N3G1
KC1N3G2
KC1N3G3
KC1N3G4
KC2N1G1
KC2N1G2
KC2N1G3
KC2N1G4
KC2N2G1
KC2N2G2
KC2N2G3

9
11
13
17
14
12
12
15
16
12
11
17
14
12
10
18
9
12
12
17
14
15
11
18
10
12
9
19
15
11
14
16
16

3
3
3
3
3

2
2
2
2
2

2
3
3
3
3

4
1
2
3
4

KC2N2G4
KC2N3G1
KC2N3G2
KC2N3G3
KC2N3G4

18
15
18
15
13

;
proc glm;
class khoi kcach luongN giong;
model y = khoi luongN luongN*khoi giong giong*luongN khoi*luongN*giong kcach
khoi*kcach luongN*kcach khoi*luongN*kcach kcach*giong kcach*luongN*giong/ss3;
test h=luongN e=khoi*luongN; test h=giong luongN*giong e=khoi*luongN*giong; test
h=kcach e=khoi*kcach;
19

test h=luongN*kcach e=khoi*luongN*kcach;


means luongN giong kcach giong*luongN/ lsd;
lsmeans kcach*giong / pdiff=control adjust=dunnett;
Title Nang suat cai be xanh (tan/ha) strip split plot;
run;
;
proc glm;
class khoi kcNgiong;
model y = khoi kcNgiong/ss3;
means kcNgiong / duncan alpha=0.05;
run;
/* Chng 4
PHN TCH PHNG SAI
TH NGHIM MNG LI (LATTICE)
4.1. p dng kiu mng li
y l kiu b tr p dng cho s lng nghim thc nhiu v khng th b tr theo khi y
ngu nhin RCBD. Th d trong nh li chiu rng lung hn ch b tr chu thnh khi.
Ngoi ng rung khng t ng u hay t hp b tr nghim thc. Kiu lattice tnh
phng sai v hip phng sai n gin.
C 3 dng chnh l: mng li vung cn i (balanced square lattices), mng li vung
cn i mt phn (partially balanced square lattices) v mng li ch nht (rectangular lattices).
Bng xp hng nghim thc c trnh by v so snh vi kiu RCBD. Phng thc x l l
Proc lacttice. Cch b tr ch c nghim thc lp li 1 ln cnh nhau, do tng chnh xc.
Kt qu trung bnh c iu chnh so snh gi tr cao nht. Cch b tr th nghim theo qui
nh phc tp, vi dng b tr khi khng y cn i (Balanced Incomplete Block, BIB),
thng phi theo ng mu, chnh xc khng bng nhau khi so snh cc trung bnh. Th
nghim c: t nghim thc, b khi, k n v th nghim hay trong khi (k < t) mi nghim
thc t xut hin 1 ln trong r cc khi v mi cp nghim thc xut hin vi nhau trong khi.
Cng thc c p dng l t x r = b x k v (t-1) = r(k -1) theo Clewer (2001).
4.2. Th nghim mng li vung cn i (balanced square lattices)
Th nghim vi s nghim thc bng bnh phng s khi: t = k2, hay l s khi bng cn bc
hai ca s nghim thc: k = t. Nu t = 9, th k = 3. Nu k = 3 th t = 9.
S
ln lp li l r = k +1 = 4. Mi ln lp li c k khi, mi khi cha k nghim thc.
S
khi b = k x r = 12 = (k + 1). Do t x r = b x k = 36 = tng s s mu quan st. Khi mi
cp nghim thc xut hin 1 ln trong khi vi = [r(k -1)]/ (t-1) = [4(3 -1)]/ (9-1) = 1.
S b tr cn bng hai chiu nh sau:
Khi

Lp li 1

Lp li 2

Lp li 3

Lp li 4

20

(1)
(2)
(3)

1
4
7

2
5
8

3
6
9

(4)
(5)
(6)

1
2
3

4
5
6

7
8
9

(7)
(8)
(9)

1
7
4

5 9
2 6
8 3

(10)
(11)
(12)

1
4
7

8
2
5

6
9
3

Bi tp kho st nng sut ca 9 ging u phng m ht 9%. Lu nhp s liu xem cc


nghim thc b tr nh s trn.
Cc bin phi c ghi theo tn l Group, Block, Treatmnt, v Rep.
Th nghim ny c 9 Treatmnt (nghim thc) l 9 ging. B tr theo Block (khi) 1, 2, 3. Group
(nhm) 1 n 4 ch ln lp li trn c s n v th nghim. Th nghim ny khng c Rep
(khng c lp li). Bin p ng l Nangsuat (nng sut).
Bi tp mu 12: */
Title 'So sanh nang suat dau phung kieu lattice';
Data Dphung;
input Group Block Treatmnt Nangsuat @@;
datalines;
1 1 1 2.10 1 1 2 1.54 1 1 3 2.28
1 2 4 2.15 1 2 5 0.95 1 2 6 1.66
1 3 7 1.73 1 3 8 1.60 1 3 9 1.46
2 1 1 1.22 2 1 4 1.32 2 1 7 1.25
2 2 2 2.12 2 2 5 1.17 2 2 8 1.43
2 3 3 2.06 2 3 6 2.24 2 3 9 1.36
3 1 1 1.72 3 1 5 1.25 3 1 9 1.14
3 2 2 1.56 3 2 6 2.20 3 2 7 1.85
3 3 3 1.61 3 3 4 1.56 3 3 8 1.43
4 1 1 1.67 4 1 6 1.58 4 1 8 1.35
4 2 2 1.45 4 2 4 1.62 4 2 9 1.48
4 3 3 2.03 4 3 5 0.95 4 3 7 1.83
;
proc lattice data= Dphung;
var Nangsuat;
run;

/* Chng 5
PHN TCH TNG TC (Interaction)
V TNG HP (Mixed Effect)
5.1. Phn tch tng tc (Interaction)
Cc nghim thc trong th nghim c nh hng vi nhau lm cho hiu qu s dng c th cao
hn hoc thp hn. Trong trng hp s dng cc loi thuc, biu hin tng tc r i vi i
tng c s dng. Gi tr trung bnh bnh phng nh nht (LS-Means) c dng so snh
tng tc thuc v tng tc ca thuc*bnh vi lnh x l proc GLM (General Linear Model).
Tng tc loi thuc theo bi tp x l ANOVA hai chiu khng cn i c tng tc, vi 6 ln
lp li. Lu du . trong cc nh l cc thiu gi tr s liu.
21

Bi tp mu 13: */
title 'Phan tich phuong sai 2 chieu khong can doi';
data;
input Thuoc $ Benh $ y @@;
datalines;
1
1
1
2
2
2
3
3
3
4
4
4

1
2
3
1
2
3
1
2
3
1
2
3

44
31
30
27
11
3
3
4
20
25
26
23

1
1
1
2
2
2
3
3
3
4
4
4

1
2
3
1
2
3
1
2
3
1
2
3

41
3
3
1
34
26
12
11
1
4
12
7

1
1
1
2
2
2
3
3
3
4
4
4

1
2
3
1
2
3
1
2
3
1
2
3

35
27
6
23
33
27
.
9
2
9
12
24

1
1
1
2
2
2
3
3
3
4
4
4

1
2
3
1
2
3
1
2
3
1
2
3

12
4
24
34
31
32
27
7
12
22
5
5

1
1
1
2
2
2
3
3
3
4
4
4

1
2
3
1
2
3
1
2
3
1
2
3

18
32
25
42
3
4
2
1
3
2
14
12

1
1
1
2
2
2
3
3
3
4
4
4

1
2
3
1
2
3
1
2
3
1
2
3

21
22
24
13
36
16
19
6
3
16
17
.

proc glm;
class Thuoc Benh;
model y=Thuoc Benh Thuoc*Benh/ ss1 ss2 ss3 ss4;
run;
lsmeans Thuoc / pdiff=all adjust=tukey;
TITLE TUONG TAC 3 LOAI THUOC;

run;

/* 5.2. Phn tch nh hng tng tc kiu l ph


S dng proc mixed phn tch vi kt qu r nht l th nghim l ph v xc nh nh hng
ring bit tng yu t.
Th nghim dng ging v bin php x l l ht nh hng t l ny mm ht la. K hiu: l
ht ging (Lohat) gm c AD1, X29, H67, B55; Khi (Khoi), cch x l (Xuly) gm c nhit
chu k theo C 16 gi/8 gi (35/20doC), nhit n nh (65doC), gibberellin (GA10ppm),
nitric acid 5% (HNO3_.5%).
Bi tp mu 14: */
Data Lua;
TITLE TUONG TAC LO PHU;

Input Lohat
cards;
AD1
1
AD1
2
AD1
3
AD1
4
X29
1
X29
2

$ Khoi $ Xuly $ Tlnaymam;


35/20doC
35/20doC
35/20doC
35/20doC
35/20doC
35/20doC

48
46.7
34
35.9
58.4
74.7

22

X29
X29
H67
H67
H67
H67
B55
B55
B55
B55
AD1
AD1
AD1
AD1
X29
X29
X29
X29
H67
H67
H67
H67
B55
B55
B55
B55
AD1
AD1
AD1
AD1
X29
X29
X29
X29
H67
H67
H67
H67
B55
B55
B55
B55
AD1
AD1
AD1
AD1
X29
X29
X29
X29
H67
H67
H67

3
4
1
2
3
4
1
2
3
4
1
2
3
4
1
2
3
4
1
2
3
4
1
2
3
4
1
2
3
4
1
2
3
4
1
2
3
4
1
2
3
4
1
2
3
4
1
2
3
4
1
2
3

35/20doC
35/20doC
35/20doC
35/20doC
35/20doC
35/20doC
35/20doC
35/20doC
35/20doC
35/20doC
65doC
65doC
65doC
65doC
65doC
65doC
65doC
65doC
65doC
65doC
65doC
65doC
65doC
65doC
65doC
65doC
GA10ppm
GA10ppm
GA10ppm
GA10ppm
GA10ppm
GA10ppm
GA10ppm
GA10ppm
GA10ppm
GA10ppm
GA10ppm
GA10ppm
GA10ppm
GA10ppm
GA10ppm
GA10ppm
HNO3_.5%
HNO3_.5%
HNO3_.5%
HNO3_.5%
HNO3_.5%
HNO3_.5%
HNO3_.5%
HNO3_.5%
HNO3_.5%
HNO3_.5%
HNO3_.5%

50.5
40.2
67.4
63.6
49.7
55.4
80.5
75.7
59.1
57.8
62.4
67.1
52.5
54.9
66.2
78.2
51
60.5
72
59
53.6
55.3
74.9
75.9
66.2
67.1
54.7
59
45.9
44.6
65
71
46.6
50.1
69.7
51.3
67.8
55.5
74
70.5
50.8
56.2
50
47.4
33.9
40.3
63.7
63
49.7
57.2
69.2
61.0
58.3

23

H67
4 HNO3_.5%
57.4
B55
1 HNO3_.5%
77.2
B55
2 HNO3_.5%
75
B55
3 HNO3_.5%
62.2
B55
4 HNO3_.5%
53
;
Proc Mixed method=type3;
Classes Lohat Khoi Xuly;
Model Tlnaymam = Lohat Xuly Lohat*Xuly;
Random Khoi Lohat*Khoi;
Lsmeans Lohat Xuly;
Lsmeans Lohat*Xuly / slice=Lohat;
Lsmeans Lohat*Xuly / slice= Xuly;
Quit;

/* p dng method=type3 l ch s dng ANOVA loi 3, slice=Lohat l kho st tng tc ring


nhm l ht so vi tng th . */
/* Chng 6
THNG K M T, TNG QUAN V HI QUI
6.1. Tnh gi tr trung bnh v lch chun
Bi tp ch : thng k m t tnh gi tr trung bnh (MEAN) v lch chun (SD, STD,
standard deviation) ca th nghim khi y ngu nhin, ba khi ca 13 ging c k hiu s
nh l 4405, 4366. Kho st ba ch tiu l t l ny mm % (TLNMAM), im cng lc (vigor,
CLUC) v im kh nng sn xut ht (SXHAT). Lu : K l khi, gi tr ny ch ghi theo khi,
khng dng phn tch m t (s liu trch t NRCS, 2007).
Bi tp mu 15: */
data A;
input K GIONG $ TLNMAM CLUC SXHAT;
cards;
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2

4405
4366
4356
4414
2275
4386
4432
4361
4365
4456
4430
4376
1261
4405
4366
4356
4414
2275
4386

39
100
90
100
56
100
98
100
75
100
88
100
100
56
98
100
100
89
98

6
7
6
5
7
7
5
5
7
4
6
5
6
5
7
5
6
4
7

6
6
5
5
5
6
6
4
5
5
6
6
7
6
5
7
6
4
6

24

2
2
2
2
2
2
2
3
3
3
3
3
3
3
3
3
3
3
3
3

4432
4361
4365
4456
4430
4376
1261
4405
4366
4356
4414
2275
4386
4432
4361
4365
4456
4430
4376
1261

89
100
85
95
90
100
100
65
90
100
100
85
93
88
100
88
100
93
100
98

8
4
5
5
6
9
7
6
5
4
8
7
6
4
4
8
8
5
5
6

8
5
7
3
5
4
6
4
5
6
4
5
3
5
6
7
4
7
8
9

proc sort;
by GIONG;
proc means data=A noprint;
var TLNMAM CLUC SXHAT;
by GIONG;
output out=newA;
proc print data=newA;
TITLE THONG KE MO TA;

run;

/* 6.2. Chi-bnh phng (Chi-square) so snh tnh c lp ca hai yu t


Trc nghim tnh c lp cn c vo vn t ra l gi thit H0 l cc bin php p dng u
c nh hng nh nhau. S dng xc sut ca Chi-bnh phng tnh, nu p < 0,05 l bc b
gi thit trn, k thut p dng c nh hng, nu p > 0,05 th chp nhn gi thit trn, k thut
p dng nh nhau. Thng p dng cho cc bin php k thut xc nh nh hng n sinh
trng ca cy, cy bnh hay khng bnh cn c trn tn s xut hin (Frequency, F). Cng thc
tnh Chi-bnh phng = (F E)2/E, trong tn s c nh (Expected) E = (Tng hng x
Tng ct)/Tng s chung.
iu tra sau phun thuc nh hng sinh trng cy vi hai yu t l: (1) phun thuc v khng
phun, (2) cy tt v cy bnh. S lng cy c m trong tng s 1000 cy. Gi thit H0 l
chp nhn phun thuc v cy bnh khng nh hng nhau.
Bi tp mu 16: */
data Dieutra;
input Xitthuoc $ Struong $ Soluong @@;
datalines;
phun
benh
10

25

phun
tot
190
khong
benh
96
khong
tot
704
;
proc freq data=Dieutra order=data;
weight Soluong;
tables Xitthuoc*Struong / chisq expected cellchi2 norow nocol;
output out=ChiSqData pchi lrchi n nmiss;
title 'Chi-Square Tests Xitthuoc';
run;

/* 6.3. T test: so snh khc bit trung bnh hai mu


p dng trong trng hp iu tra chn mu hai l i chng v tc ng k thut nh phun
thuc tng n hoa, u qu, bn phn v khng bn, xt thuc dit c v khng xt thuc. So
snh hai gi tr trung bnh ca hai bin, cng cn c trn xc sut p. Nu p > 0,05 th hai bin s
khng khc nhau c ngha. p dng cho chn mu c s im chn bng nhau. Nu b tr cc
theo di v tr ging nhau ca hai nhm mu, gi l bt cp (paired comparison), nu b tr cc
theo di v tr khc nhau ca hai mu, gi l khng bt cp (unpaired comparison).
Th nghim s dng cht iu ha sinh trng Z cho ging ci du (B) v ging i chng (A)
khng x l, kt qu nng sut (tn/ha) nh sau (s liu trch t Clewer, 2001):
Bi tp mu 17: */
data;
title 'SO SANH T TEST';
input S A B;
diff=B-A;
cards;

1 3.5
4.
2
6
4.
3
0
4.
4
3
4.
5
0
4.
6
6
7 5.0
8 3.9
9 3.5
1 4.
0
8

5.5
4.1
4.5
6.1
4.6
5.3
5.4
3.9
4.4
6.1

;
proc means mean stderr t prt;
var diff;
run;

26

/* 6.4. Tnh ma trn tng quan (correlation matrix)


Xc nh ma trn tng quan hai chiu cc bin s ng nht p dng i vi nng sut cy l
tm yu t no nh hng ln nht n nng sut cy, t xut bin php ci thin nng sut
hp l.
Lu s dng gi tr h s tng quan r v xc sut p. Vi s cp mu n = 12, nu r > 0,7 l
tng quan cht, nu p < 0,05 th kt lun c khc bit gia hai bin s. Nu p > 0,05 th hai bin
s khng khc nhau c ngha.
Kho st tng quan nng sut cy c ph (kg/cy), k hiu l NSUATCAY vi t l ht trn
(%) (HATTRON), t l nhn/qu (%) (NHANQUA), cp ht R1 (%) l t l ht c gi li trn
sng ry 6,3 mm v trng lng 100 qu (g) (TL100QUA). Tng quan ny c kho st t
th nghim bn phn m kt hp thch cao.
Bi tp mu 18: */
DATA;
TITLE MA TRAN TUONG QUAN;

INPUT NSUATCAY HATTRON NHANQUA R1 TL100QUA;


CARDS;
1.83
22.8
15.6
40.8
103.7
1.82
18.0
16.2
41.3
112.6
1.82
21.1
15.7
42.4
106.6
1.83
20.9
15.5
41.2
105.9
1.84
14.9
16.6
43.7
112.5
1.86
12.8
16.9
44.9
124.4
1.90
12.8
17.1
42.4
118.6
1.93
11.9
17
69.6
134.2
1.85
12.4
17.2
43.9
118.6
1.96
11.9
17.2
70.7
128.7
2.08
11.5
17.4
80.4
142.3
2.01
12.5
17.0
70.4
134.6
;
PROC CORR OUTP=P;
RUN;
PROC PRINT DATA=P;
RUN;

/* 6.5. Hi qui tuyn tnh n bin (simple regression)


Xc nh phng trnh y = ax + b ca hai ch tiu th hin vi phng trnh hi qui c ngha.
Kho st phng trnh hi qui ca trng lng kh X g (TLKHO) v din tch l Y cm 2 (DTLA)
ca cy c thc n gia sc do bn phn nh sau (s liu trch t Clewer, 2001):
Bi tp mu 19: */
DATA A;

title 'hoi qui tuyen tinh';


INPUT TLKHO DTLA;
CARDS;

27

0.29
0.43
0.21
0.53
0.27
0.33
0.47
0.40
0.48
0.30
0.37
0.30

144
180
60
226
105
111
217
221
218
137
153
105

PROC REG DATA=A;


MODEL DTLA = TLKHO;
RUN;
symbol1 c=blue i=none
v=dot;
PLOT DTLA*TLKHO/cframe=white;
RUN;

/* 6.6. Hi qui bc hai, xc nh ng biu din


Th nghim p dng lng m N nh hng n nng sut ht rau hng qu
Bi tp mu 1: */
title 'Anh huong luong N den nang suat hat rau hung que (tan/ha);
data nangsuat;
input luongN nsuat @@;
datalines;
0 0.15
50 0.32
100 0.64
150 0.72
200 1.35
250 1.05
300 0.91
350 0.80
;
proc rsreg data= nangsuat;
model nsuat=luongN /lackfit;
run;
proc glm;
model nsuat=luongN luongN*luongN / p clm;
output out=pp p=nsuatpred r=resid;
axis1 minor=none major=(number=5);
axis2 minor=none major=(number=8);
symbol1 c=blue i=none
v=dot;
symbol2 c=red i=spline v=none;
proc gplot data=pp;
plot nsuat*luongN=1 nsuatpred*luongN=2 / overlay haxis=axis1 vaxis=axis2;
run;

28

/* 6.7. ng biu din ba chiu


Bi tp mu 20: */
data measure;
input Potassium
lines;
50
30
50
60
50
90
70
30
70
60
70
90
90
30
90
60
90
90
50
30
50
60
50
90
70
30
70
60
70
90
90
30
90
60
90
90
50
30
50
60
50
90
70
30
70
60
70
90
90
30
90
60
90
90

Nitrogen Nangsuat @@;


1140
2776
1786
2020
2224
2807
1186
2030
1724
1910
2100
1275
2142
2900
2185
906
2111
1872
905
2052
1741
2900
2100
2700
900
2700
2100

;
data measure1;
set measure;
run;
proc sort data=measure1;
by Nitrogen Potassium;
run;
data Measure1;
set measure1;
by Nitrogen Potassium;
if last.Potassium then Potassium=Potassium+0.000001;
run;
data pred;
do Potassium=50 to 90 by 1;
do Nitrogen=30 to 90 by 1;

29

output;
end;
end;
run;
proc tpspline data=measure;
model Nangsuat=(Potassium Nitrogen) / lognlambda=(-4 to -2 by 0.1);
score data=pred out=preNangsuat;
output out=estimate pred uclm lclm;
title ' ';
run;
proc g3d data=preNangsuat;
plot Nitrogen*Potassium=p_Nangsuat/grid
zmin=0
zmax=3000 ctop=blue cbottom=yellow caxis=green
zticknum=5
xticknum=5
yticknum=5;
title 'Tuong quan nang suat hat dau phung (kg/ha) voi luong K va N (kg/ha);
run;

/* Chng 7
PHN TCH S LIU BNG TH
S liu c phn tch bng th trong chng ny th hin s liu dng biu xc nh
thnh phn chnh, mt tng ng a bin, th thnh phn cht lng chnh, s cy ph h.
7.1. Phn tch thnh phn chnh (Principal component analysis)
Phn tch thnh phn chnh c th s dng s liu th, ma trn tng quan, ma trn hip phng
sai, tng bnh phng. Thnh phn chnh th nht c bin lng ln nht, sau thnh phn
chnh cui cng c bin lng nh nht ca kt hp tuyn tnh vi cc bin ban u.
Bi tp v thng k nhit trung bnh thng 1 v thng 7 mt s vng trng c ph Vit Nam,
so vi nhit thch hp cho c ph Arabica v Robusta.
Bi tp mu 21: */
Data Nhietdo;
title 'Nhiet do trung binh thang 1 va thang 7 mot so tinh trong ca phe';
input Tinh $1-15 Thang1 Thang7;
datalines;
Lam Dong
18.0 24.0
Gia Lai
19.0 27.0
Dak Lak
20.0 26.0
Quang Tri
18.0 27.0
Binh Phuoc
24.0 27.0
Dong Nai
25.0 27.0

30

Son La
17.0 26.0
Nghe An
20.0 26.0
ARABICA
18.0 23.0
ROBUSTA
20.0 30.0
;
title2 'Do thi nhiet do (do C)';
%plotit(data=Nhietdo, labelvar=Tinh,
plotvars=Thang7 Thang1, color=black, colors=blue);
run;
proc princomp data=Nhietdo cov out=Prin;
title2;
var Thang7 Thang1;
run;
title2 'Cac diem cua Principal Components';
%plotit(data=Prin, labelvar=Tinh,
plotvars=Prin2 Prin1, color=black, colors=blue);
run;

/* 7.2. Phng php so snh h s tng ng v khc bit


Cc s hin din ca yu t c th hin theo nh lng bng s thp phn; nh tnh nh c
hay khng c m ha bng s, nu xc nh l c k hiu l 1, v khng c k hiu l 0. Cc
yu t ny p dng cho s phn tch cc yu t x hi, nghin cu sinh hc, di truyn (SAS,
2004).
7.2.1. Xc nh khc bit khong cch cc ch tiu nh lng theo h s Euclid:
S dng phng php tnh khc bit khong cch theo phng php trung bnh s hc
(UPGMA) cc ch tiu nh lng.
So snh khong cch khc bit Euclid ca 10 ging kho st l A, B, C ..J vi 5 ch tiu t ct1
n ct5. X l distance theo bng lp trnh nh sau:
Bi tp mu 22: */
data caytrong;
input Giong $ ct1 ct2 ct3 ct4 ct5;
cards;
A
8
5
11
10
11
B
7
6
13
18
6
C
9
3
12
22
12
D
13
3
9
8
10
E
6
7
8
7
10
F
12
10
18
17
19
G
9
5
17
18
13
H
7
7
21
26
13
I
11
5
22
24
19
J
6
7
13
18
14
;
proc distance data= caytrong out=Dist method=Euclid;

31

var interval(ct1--ct5 / std=Std);

id Giong;
run;
proc print data=Dist(obs=10);
title 'So sanh UPGMA 10 giong xu ly PROC DISTANCE';
run;
proc cluster data= Dist method=average rsq pseudo outtree=Tree;
id Giong;
run;
axis1 order=(0 to 1 by 0.1);
proc tree data=Tree haxis=axis1 horizontal lines= (color=green) lines=
(width=2);
height _rsq_;
id Giong;
run;

/* 7.2.1. Xc nh cc ch tiu s liu nh phn theo h s Dice:


S dng phng php tnh khc bit khong cch theo phng php trung bnh s hc
(UPGMA)
Bi tp mu 23: */
data caytrong;
title 'Khoang cach Dice';
input giong $ p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17 p18 p19 p20 p21
p22 p23 p24 p25 p26 p27 p28 p29 p30 p31 p32 p33 p34 p35 p36 p37 p38 p39 p40 p41 p42 p43
p44 p45 p46 p47 p48 p49 p50 p51 p52 p53 p54 p55 p56 p57 p58 p59 p60 p61 p62 p63;
datalines;
A1
1
0
0
1
0
1
0
0
1
1
0
0
0
0
1
1
0
0
1
1
0
0
0
1
0
1
0
1
1
1
1
1
0
1
1
1
0
1
0
0
0
1
0
1
1
0
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
0
0
B2
1
0
1
0
0
1
1
1
1
1
0
0
1
1
1
1
1
1
1
1
0
1
0
1
0
1
0
0
1
0
1
1
1
1
1
1
1
1
0
0
0
1
0
0
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
C3
1
0
0
1
0
1
0
0
1
1
0
0
0
0
1
1
0
0
1
1
0
0
0
1
1
1
0
1
0
1
1
1
0
1
1
1
1
1
0
1
0
1
0
0
1
0
1
1
1
1
1
1
0
1
1
0
1
0
1
1
1
0
0
D4
1
1
0
0
0
1
0
0
1
1
0
1
1
1
0
1
0
0
1
1
0
0
1
1
0
1
0
0
1
1
1
1
1
0
1
1
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
0
1
1
0
1
1
1
1
0
0
1
E5
1
0
1
0
0
1
1
0
1
1
1
0
0
0
1
1
0
0
1
1
1
0
1
1
1
1
1
0
1
0
1
1
1
1
1
1
0
0
1
0
0
0
0
1
1
0
1
1
1
1
0
0
0
1
1
1
1
1
1
1
1
0
0

32

F6

G7

H8

K9

0
1
0
0
0
1
1
0
1
0
0
0
0
1
0
1
1
0
0
0

1
1
0
1
0
0
1
0
1
1
1
0
0
0
1
0
0
0
1
1

0
1
0
0
1
0
1
1
1
1
0
1
1
1
1
1
1
1
1
1

0
0
0
0
0
1
1
1
0
0
1
1
0
0
1
0
1
1
1
1

0
1
1
1
1
0
1
1
0
0
0
1
1
0
0
1
1
1
1
1

1
1
0
1
0
1
1
0
1
1
1
1
0
1
1
1
1
1
1
1

0
1
1
1
0
0
1
1
1
1
1
0
1
1
1
1
1
1
1
1

1
1
1
1
1
0
1
1
0
1
1
1
1
0
1
1
0
1
0
1

0
0
1
1
0
1
0
1
1
1
1
0
1
1
0
1
0
1
1
1

1
0
1
1
1
1
0
0
1
0
1
0
0
1
0
1
1
1
1
0

0
1
0
1
0
0
1
1
1
1
1
1
1
1
1
0
1
0
1
0

0
0
0
0

1
1
1
1

0
1
1
0

1
1
0
1

0
0
1
0

1
1
0
1

0
1
0
0

1
1
1
0

;
proc distance data=caytrong method=Dice absent=0 out=DistDice;
var anominal (p1-p63);
id giong;
run;
proc print data=distDice (obs=9);
id giong; var A1--K9;
run;
title2;
proc cluster data= caytrong method=average rsq pseudo outtree=Tree;
id giong;
run;
axis1 order=(0 to 1 by 0.1);
proc tree data=Tree haxis=axis1 horizontal lines= (color=green) lines= (width=2);
height _rsq_;
run;

33