You are on page 1of 38

Chng 5

M HNH HI QUY TUYN TNH


5.1. M HNH HI QUY TUYN TNH N
5.1.1. Vn m hnh hi quy
Nhiu bi ton trong khoa hc k thut i hi kho st quan h
gia hai hoc nhiu bin. Ly lm v d, chng ta xt s liu Bng
5.1, y ch th sch ca oxy sinh ra trong qu trnh chng ct
ha hc, cn x l nng phn trm ca hydrocarbon c mt bnh
ngng b phn chng ct.
Bng 5.1. sch ca oxy ng vi t l phn trm hydrocarbon

TT
1
2
3
4
5
6
7

x(%)
0.99
1.02
1.15
1.29
1.46
1.36
0.87

y(%)
90.01
89.05
91.43
93.74
96.73
94.45
87.59

TT
8
9
10
11
12
13
14

x(%)
1.23
1.55
1.4
1.19
1.15
0.98
1.01

y(%)
91.77
99.42
93.65
93.54
92.52
90.56
89.54

TT
15
16
17
18
19
20
21

x(%)
1.11
1.2
1.26
1.32
1.43
0.95
1.32

y(%)
89.85
90.39
93.25
93.41
94.98
87.33
94.01

Khi th hin cc im (x i , yi ) ln th, ta nhn c th ri


im nh Hnh 5.1. Ta nhn thy, mc du khng c ng cong n
gin no i qua cc im ny, song c th khng nh rng, cc im y
dng nh nm phn tn quanh mt ng cong vi phng trnh
y f (x) no . Vy c th gi thit rng gi tr trung bnh ca Y bin
ch th sch khi nng phn trm X ca hydrocarbon ti mc x tha
mn quan h

E(Y | x) f (x)

(5.1.1)

tng qut ha, chng ta nn dng m hnh xc sut bng cch coi
Y l BNN m ng vi gi tr x ca bin X th
209

Y f (x)

(5.1.2)

vi l sai lm ngu nhin.


Trc ht chng ta xt trng hp n gin nht, cng rt hay
xy ra trong thc t, khi f (x) ax b . Khi (5.1.2) tr thnh
(5.1.3)

Y ax b
100

95

90

85
.8

1.0

1.2

1.4

1.6

Hnh 5.1. th ri im, ng hi quy cho s liu sch ca oxy

M hnh (5.1.3) c gi l m hnh hi quy (MHHQ) tuyn tnh


n; x c gi l bin hi quy (hay bin c lp, bin gii thch), Y
c gi l bin phn hi (hay bin ph thuc, bin c gii thch);
a, b c gi l cc tham s hi quy, a: h s chn, b: h s gc;
ng thng y ax b c gi l ng hi quy (l thuyt).
M hnh c gi l tuyn tnh v n tuyn tnh vi cc tham s
a, b (a, b c ly tha 1); c gi l n v c mt bin hi quy.
bi 5.2 chng ta s xt m hnh hi quy bi vi t nht 2 bin hi
quy. Ngi ta cng xt m hnh hi quy phi tuyn, hm hi quy
l hm phi tuyn ca cc tham s (xem [1], [9]).
Gi s quan st th i bin X nhn gi tr x i , bin Y nhn gi tr yi
v sai lm ngu nhin l i . Nh vy, di dng quan st, m hnh (5.1.3)
tr thnh

210

y1 a bx1 1

. . . . . . .
y a bx
n
n
n

(5.1.4)

Lu rng yi l cc BNN.
kho st m hnh chng ta phi tin hnh cc th nghim, cc
php o c hay cc php quan st, gi chung l quan st, c b s
liu {(x i , y i )} . Thng qua b s liu ny, ngi ta a ra cc xp x (c
lng) tt cho cc tham s. M hnh vi cc h s c lng c gi
l m hnh thc nghim (empirical model) hay m hnh lc (filted model).
Dng m hnh thc nghim chng ta c th tin hnh mt s d on,
tnh cc gi tr cc tr cng nh cc kha cnh ca vn iu khin.
5.1.2. c lng h s hi quy
By gi gi s cc BNN y1 ,..., y n nhn cc gi tr c th no , vn
k hiu l y1 ,..., y n . Khi
i yi (ax i b)

(5.1.5)

th hin lch ca quan st th i so vi ng hi quy l thuyt


(xem Hnh 5.2). Tng bnh phng cc lch
n

i 1

i 1

ei2 (yi (a bxi ))2


th hin cht lng ca vic xp x s liu bi ng hi quy l
thuyt. Ta khng th bit ng hi quy l thuyt, vic ta c th lm
l tm cc h s a, b
n

(a, b) (yi (a bx i )) 2 min .

(5.1.6)

i1

V (a, b) l a thc bc 2 ca 2 n a, b; iu kin cn n t


cc tiu l

0.
a b

(5.1.7)

211

lch

ng hi quy
thc nghim
ng hi quy
l thuyt

Hnh 5.2. lch v cc ng hi quy l thuyt, thc nghim

Thc ra chng minh c y cng l iu kin . y l h 2


phng trnh tuyn tnh bc nht ca a, b. khng kh khn g ta tnh
c nghim ca h ny l:
xy x. y
b
SXX / n

a y b x

(5.1.8)

trong
x

n
1 n
1 n
1 n
x i ; y yi ; xy x i yi ; SXX (x i x) 2 . (5.1.9)

n i1
n i 1
n i 1
i 1

Vi cc L ny ta c phng trnh hi quy thc nghim


b .
y ax

(5.1.10)

Phng php tm cc L ca h s nh trn gi l phng php


bnh phng cc tiu.
Cc phng trnh (5.1.5) - (5.1.10) p dng vi mi gi tr c
th ca cc BNN y1 ,..., y n nn chng cng ng cho cc BNN ny.
Di y, khi p dng cc phng trnh ny v khi khng s lm ln, ta
khng phn bit cc BNN y1 ,..., y n vi cc gi tr c th ca chng.
212

5.1.3. Tnh cht ca c lng ca cc h s hi quy


Nh vy, ng hi quy i qua
T (5.8) ta c ngay y a bx.
im trung tm (x, y) ca s liu.

Lu rng, L h s (5.1.8) hon ton khng cn cc gi thit


v cc thnh phn ngu nhin i . c cc tnh cht tt ca L, cn c
nhng gi thit t ln cc thnh phn ngu nhin ny. Gi thit d chp
nhn l chng c k vng khng, cng phng sai 2 , c lp; gi thit
tip sau l chng c phn b chun:
1 ,..., n c lp, cng phn b chun N(0; 2 ) . (5.1.11)

Khi L h s c nhng tnh cht thng k tt th hin nh l


sau.
nh l 5.1. Khi iu kin (5.1.11) tha mn th:
i) a v b ln lt l L khng chch ca tham s a v b:
a;
E[a]

b
E[b]

(5.1.12)

ii) Phng sai ca cc L a v b c tnh nh sau

1 (x) 2
2
2a V[a]
n S ,
XX


2b V[b]

2
SXX

(5.1.13)

iii) L khng chch ca phng sai chung 2 ca m hnh cho bi


2

1 n 2
1 n
ei

(yi y i ) 2
n 2 i 1
n 2 i 1

(5.1.14)

vi
: d bo ca quan st th i
y i a bx
i
ei yi y i :

phn d th i.
213

tng chng minh phn i) da vo ch a v b l t hp tuyn


tnh ca cc BNN chun nn chng l cc BNN chun, ri thc hin php
ly k vng. Chng minh phn ii) v iii) da vo nh l 3.20, 3.21 v
cc php ton ma trn. Tuy nhin trnh by chng rt di nn khng vit
ra y; c gi quan tm c th xem [1], [9].
V 2 trong cng thc (5.1.13) cha bit, ta phi dng xp x
ca n l 2 . Chng ta a ra nh ngha.
nh ngha. i vi m hnh HQTT n, sai s chun ha (thc
nghim) ca h s gc v h s chn ln lt c xc nh bi


se(b)

2
;
SXX

1 x2
2
se(a)

n SXX

(5.1.15)

trong , 2 c tnh theo (5.1.14).


5.1.4. Kim nh gi thuyt
Mt khu quan trng kim tra tnh ph hp ca MHHQ l
v 2 l nhng BNN nn c
b,
kim nh gi thuyt. Cc h s a,
th lm mt s kim nh v chng. Ta lun nh rng iu kin
(5.1.11) phi c tha mn. Cc i thuyt a ra di y u l 2
pha. c gi c th a ra i thuyt 1 pha vi iu chnh thch hp
cc ngng ph phn.
a) S dng kim nh T
H s gc l tham s quan trng nht ca MHHQ tuyn tnh
n. Xt bi ton kim nh gi thuyt hai pha:

H 0 : b b0 / H1 : b b 0 .

(5.1.16)

y, b 0 l gi tr cho trc. T gi thit (5.1.11), yi l cc


BNN c lp v yi N(a bx i ; 2 ) . b l t hp tuyn tnh ca cc
BNN y nn n cng c phn b chun. Theo nh l 5.1, b c phn
i

b chun N(b; 2 / SXX ) . Ngoi ra, nh trong chng minh ca nh

214

l trn, (n 2) 2 / 2 c phn b khi bnh phng vi n - 2 bc t do


v c lp vi b . Theo nh l 3.21, di gi thuyt H th
0

Tb

b b 0
2 / SXX

T(n 2) .

(5.1.17)

Nh vy, chng ta s bc b H0 ( mc ngha ) nu


Tb

b b0

se(b)

b b 0
2 / SXX

t (n 2) .

(5.1.18)

Trng hp c bit quan trng l khi b0 0 :

H 0 : b 0 / H1 : b 0 .

(5.1.19)

iu ny lin quan n ngha (hay tc dng) ca hi quy


(significance of regression): Nu khng bc b H 0 (coi b 0) th c
ngha rng khng c mt quan h tuyn tnh no gia X v Y (c th
l quan h thc s ca X v Y l quan h phi tuyn), s thay i ca
bin X khng ko theo s thay i d on bin Y, X khng c (hoc
rt t) tc dng d on Y; d on cho Y tt nht nn dng Y.
Tng t, gi thuyt lin quan n h s chn l
H 0 : a a 0 / H1 : a a 0 .

(5.1.20)

a a 0

(5.1.21)

Bi v
Ta

T(n 2)

1
x

n SXX
2

nn gi thuyt b bc b mc nu

Ta

a a 0

se(a)

a a 0
x2

n SXX
2 1

t (n 2) . (5.1.22)
2

215

b) Phn tch phng sai


Phng php phn tch phng sai c dng kim nh tnh
hiu qu ca vic lp m hnh. Trc ht, t ch
yi y (y i y) (yi y i ) , bnh phng hai v ri ly tng ta c:
n

i 1

i1

i 1

(yi y)2 (y i y)2 (yi y i )2

(5.1.23)

Chng ta xc nh cc i lng sau y:


n

Tng bnh phng y : SST SYY (yi y) 2 ,


i 1
n

Tng bnh phng hi quy: SSR (y i y)2 ,


i1

Tng bnh phng cc phn d (cc sai s):


n

SSE (yi y i ) 2 .

(5.1.24)

i 1

Biu thc (5.1.23) c vit li di dng:

SST SSR SSE

(5.1.23)

C th chng minh rng, SSR / [ 2 b2SXX ] v SSE / 2 l


nhng BNN c lp, c phn b khi bnh phng vi 1 v n - 2 bc
t do tng ng. Nh vy, nu gi thuyt H 0 : b 0 l ng th
F0

SSR / 1
MSR

SSE / (n 2) MSE

(5.1.25)

c phn b F(1, n 2) ) (xem nh l 3.23).


Cc i lng MSR , MSE gi chung l bnh phng trung bnh.
Ni chung, bnh phng trung bnh c tnh bng cch ly tng
bnh phng chia cho bc t do ca n.
Chng ta s bc b H0 nu F0 f (1; n 2) .
216

Trong cc phn mm thng k, th tc kim nh c trnh by


bng phn tch phng sai ging nh Bng 5.2.
Bng 5.2. Phn tch phng sai kim nh tnh hiu qu ca hi quy

Ngun

Tng cc
bnh
phng

Hi quy
Sai s
y

Bc t
do

SSR
SSE
SST

1
n-2
n-1

Bnh
phng
trung bnh
MSR
MSE

F0

MSR
MSE

Pgi
tr
P

Nu P-gi tr ln hn mc ngha chn trc, chng ta phi chp


nhn gi thuyt b 0 , tc l vic xy dng m hnh khng c tc
dng. Cn phi tm m hnh khc, ly thm s liu
Lu . Chng minh c, th tc phn tch phng sai v th tc
kim nh T cho bi ton kim nh gi thuyt 2 pha (5.1.16) l
tng ng theo ngha chp nhn gi thuyt hay bc b gi thuyt l
ng thi vi 2 th tc ny. Tuy nhin, kim nh T linh ng hn,
c th xt kim nh 1 pha, trong khi phn tch phng sai ch c th
xt 1 pha. Mt khc, phn tch phng sai c th tng qut sang
trng hp hi quy bi xt n bi 5.2.
5.1.5. Khong tin cy
a) Khong tin cy ca cc tham s
Bi v cc thng k Ta , Tb (5.1.22), (5.1.17) c phn b
T(n 2) nn d dng xy dng khong tin cy cho chng.
Vi gi thit chun (5.1.11), khong tin cy 100(1 )% cho h
s chn a v h s gc b ln lt l

a t /2 (n 2) 2 1 x ,

n SXX

2
b t /2 (n 2)

SXX

(5.1.26)

217

b) Khong tin cy cho p ng trung bnh


V y0 E[Y | x 0 ] a bx 0 nn mt L im cho gi tr ny l
. y l L khng chch v a v b l L khng chch
y 0 a bx
0
2

2 1 (x 0 x)

ca a v b. Phng sai ca a bx
. Tuy
0 l
SXX
n

nhin, v ni chung chng ta khng bit 2 m phi dng L 2


y 0 y0
ca n. D thy rng
T(n 2) . T ta c:
2

1
x
2

n SXX
Khong tin cy 100(1 )% cho p ng trung bnh khi x x 0
l (y 0 ) , trong

t /2 (n 2) 2 1 (x 0 x) ,
SXX .

.
y 0 a bx
0

(5.1.27)

c) D on quan st tng lai


Mt ng dng quan trng ca phn tch hi quy l d on quan
st (c bit) ca bin Y trong tng lai ti mc x 0 cho trc ca bin
hi quy, k hiu l Y | x 0 hay n gin l Y0 .
L im cho gi tr quan st tng lai ca BNN l gi tr trung
bnh ca n, y l y0 a bx 0 . Cc tham s a, b li cha bit, ta
phi dng L ca chng. Vy, L im cho Y0 l
.
y 0 a bx
0

(5.1.28)

Ch rng BNN Y0 l quan st tng lai, n c lp vi cc


quan st qu kh y1,..., y n . Cng vi cc gi thit c lp, cng phn
b chun ca cc sai s, sai s d on e0 Y0 y 0 c phn b
chun quy tm, phng sai
218

1 (x x 0 ) 2
V[e0 ] V[Y0 ] V[y 0 ] 2 1
.
SXX
n
Ging nh trn, ta tm c khong tin cy (cn gi l khong d
on) 100(1 )% cho quan st tng li Y0 ti x 0 l (y 0 )
vi

t /2 (n 2) 2 1 1 (x 0 x) ,
SXX (5.1.29)

.
y 0 a bx
0

Nhn xt. C hai khong (5.1.27) v (5.1.29) u t cc tiu ti


x 0 x v rng dn khi x 0 i ra xa x . Mt khc, vi cng mc
ngha, cng xt ti im x 0 , khong d on lun lun rng hn
khong tin cy. Chng ta s thy r hn hin tng ny v d sau.
V d 5.1. Thng thng, ngi ta vn ngh mc tiu th nhin
liu khng ph thuc vo vic li xe nhanh hay chm. kim tra
ngi ta cho chy th mt chic xe con nhiu vn tc khc nhau t
45 n 70 dm/gi. Kt qu ghi thnh bng
Vn tc
Mc tiu th
(ml/gal)

45

50

55

60

65

70

75

24,2 25,0 23,3 22,0 21,5 20,6 19,8

Liu c th thay i cch ngh rng mc tiu th nhin liu khng


ph thuc vo vn tc xe? Tm cc khong tin cy 95% cho gi tr
trung bnh v ca quan st tng lai ca mc tiu th nhin liu khi
xe vn tc 50 ml/h .
Gii. Chng ta xt m hnh HQTT n Y a bx , trong
Y l mc tiu th nhin liu, x l vn tc xe. Cn phi xt xem h s
b c bng khng hay khng. Mun th ta xt bi ton kim nh:

H 0 : b 0 / H1 : b 0 .
Tnh ton cc thng k lin quan ta c
219

x 60;

SXX 700; y 22,343; SYY 21,757; SXY 119


a 32,543;
b 0.17;
SSR 1.527
M hnh thc nghim: y 32,54 0,17x .
Tra bng ta thy t 0.025 (5) 2,571 . Theo (5.1.26), khong tin cy
1.527
) (0, 224; 0,116) . Khong
3500
ny khng cha im 0, vy ta bc b gi thuyt b 0 vi mc
ngha 5%; coi b 0 , tc l mc tiu th nhin liu ph thuc vo
vn tc xe. Cng c th tnh trc tip bc b b 0 :

95% ca b l (0,170 2.571

Tb

b b 0
2 / SXX

0,17
0,305426
700

8,13 2, 571 t 0.025 (5) .

27

25

23

21

19

17
40

50

60

70

80

Hnh 5.3. Khong tin cy (2 ng Hyperbol gia)


v khong d on ( 2 ng hyperbol ngoi) cho mc tiu th nhin liu

Dng (5.1.27) v (5.1.29), khong tin cy v khong d on


95% ti vn tc 50ml/h l

220

24,04 2,571 1 (50 60)

700
7

(24,04 1,37) (22,67; 24, 41)

24,04 2,571 1 1 (50 60) (24,04 2,92) (21,12; 26,96)

7
700

Khi x 0 thay i, mt trn v mt di ca khong tin cy to


thnh 2 ng hyperbol gia, ca khong d bo to thnh 2 ng
hyperbol ngoi Hnh 5.3. Mt ln na ta thy khong tin cy cho
gi tr trung bnh ca quan st l hp hn.
#
d) Lu khi s dng MHHQ
Trng hp ni suy. Ni chung, sau nhng kim nh cn
thit, chng ta c th s dng MHHQ thc nghim (5.1.10) lm
mt s d on ni suy. C th l, khi X nhn gi tr x 0 nm trong
di bin thin [a; b] ca s liu, gi tr d on ca trung bnh, cng

nh gi tr quan st tng lai ca bin u ra s l a bx


S
0

chnh xc ca cc cng thc ny ch ra phn b) v c).


Trng hp ngoi suy. S dng phng trnh hi quy d
on gi tr ca bin Y ng vi nhng gi tr ca bin u vo X nm
ngoi di bin thin ca s liu gi l d on ngoi suy. Tuy nhin,
ngoi di bin thin ca s liu, cc gi thit v m hnh, thm ch
l quan h E[Y | X x] ax b c th khng cn ng. V th, d
on vi sai lm ng k c th gy ra t ngoi suy.
y

Ngoi suy

Ni suy
a D on ni suy v ngoibsuy.
Hnh 5.4.

221

Mt cch khc phc l ly thm quan st (lm thm th nghim)


di bin thin rng ra, cha im ta quan tm. Tuy nhin trong k
thut, nhiu khi ngoi suy l cch duy nht m ta c th tim cn vn
. Cn lu rng ta nn p dng n mt cch mm mng, vi x 0
khng xa di bin thin [a; b], ta vn c th c kt qu kh d. Tm
li, ta ch p dng ngoi suy mt cch hn hu khi rt cn thit, cha
th c s liu v khng cn cch no khc.
5.1.6. Tnh ph hp ca m hnh
a) Phn tch phn d
Bc khi u ca phn tch hi quy l dng th ri im ca
quan st. Nu dng iu th tp trung quanh 1 ng thng no ,
chng ta s i tm cc h s a, b. Tuy nhin, vic lp m hnh phi da
vo cc gi thit chun (5.1.11). V cc phn d ei y i y i i din tt
cho cc sai s i , ngi ta thng dng phn tch phn d kim
tra xem m hnh c ph hp hay khng.
Cc phn d phi tun theo phn b chun. Mt phng php kim
tra xp x tnh chun l lp t chc khi s quan st n ln, hoc lp
th P - P chun khi n nh (xem mc 4.7.1d ).
Ngi ta cng hay dng cc phn d chun ha d i ei / 2 ,
i 1,..., n . Nu cc sai s c phn b chun, c khong 95% cc phn
d chun ha ri vo khong (-2; 2) (nu Z N(0;1) th
P{ 2 Z 2} 0,95 ). Hn na, th di phi c dng bnh
thng, tp trung u n trong di (-2; 2) quanh trc honh nh
dng (a) Hnh 5.5. Vi phm iu , chng hn nu n c dng (b),
(c), (d) th phi sa cha m hnh, hay tm m hnh khc v phn tch
li.
Bi v {i ,i 1,..., n} l dy cc BNN c lp th khi sp xp
chng theo th t bt k vn c dy cc BNN c lp. Chng ta
va ni n dy phn d d i theo chiu tng ca ch s thi gian i.
Ngi ta cng lp dy phn d theo chiu tng ca x i hay ca y i .
Nu mt trong cc th c dng (b) th phng sai ca sai s
tng ln theo thi gian (theo chiu tng ca xi hay ca y i ), xy ra (c)
222

th phng sai ca sai s thay i, xy ra (d) th cn thm mt s


hng bc cao hn vo m hnh a thc hay phi tm m hnh khc.
(a)

(b)

(c)

(d)

Hnh 5.5. Dng iu phn d

b) H s xc nh (coefficient of determination)
H s xc nh k hiu bi R2 c tnh theo cng thc sau:
R2

SSR
SS
1 E .
SST
SST

(5.1.30)

Theo (5.1.23), tnh cht ca h s xc nh l


0 R 2 1.

i th, ta thng coi R 2 nh l bin ng trong bin u ra


c gii thch bi cc gi tr u vo khc nhau. Khi R 2 ln, gn
bng 1, th c ngha rng hu nh bin ng ca cc bin u ra
c gii thch bi s khc bit ca cc bin u vo. Chng hn, vi
s liu mc tiu th xng, v R 2 0, 9298 nn ta ni m hnh cha
ng 92,98 % bin ng trong s liu.

223

Gi rXY l h s tng quan mu ca cc cp im (x i , y i )


(xem mc 4.1.2e) th ta c th thy
2
R 2 rXY
.

(5.1.30)

Nh vy, nu coi X l BNN th h s xc nh R 2 chnh bng


bnh phng ca h s tng quan mu gia X v Y. Tuy nhin
2
chng ta vn vit h s xc nh l R 2 m khng phi rXY
v X
khng l BNN.
Gi tr R 2 thng c xem nh mt ch th cho tnh tt ca
m hnh: Khi gi tr ny gn bng 1, m hnh ph hp tt; khi gi tr
ny nh, gn bng 0, m hnh khng ph hp vi s liu, cn tm m
hnh khc. Tuy nhin, cn thn trng, ngng no cho mt m hnh
c th li l iu ta cha bit, t ra l n thi im ny.
Lu . Lin quan n my tnh b ti CASIO, ta c th tnh 2
nh sau:

R 2 1

n
n 2 1 n
n 2 2
2 1
2

(y

y
)
/
(y

y)

i i
i
n n 2 i 1
n i 1
n (yn)2

2
vi

n
(1 R2 )(yn)2
n2

(yn)2 S 2Y

(5.1.31)

1 n
(y i y)2 .
n i 1

V d 5.2. Trong nh my sn xut cc linh kin bn dn, linh


kin hon chnh l dy c b xp li thnh mt ci khung. Ngi
ta quan tm n 3 bin: lc ko (s o ca lc lm cho khung b
hng), di ca dy, v chiu cao ca khun c. S liu c 25
quan st th hin 4 ct u Bng 5.5.
Trc ht ta quan tm n mi quan h gia lc ko y v di
x1 ca dy, y tin ta vn k hiu l x. Th hin s liu ln
th, dng nh y l quan h tuyn tnh. Chng ta dng m hnh
Y ax b lc s liu. Ta tnh c:
224

1 n
xi 8, 24;
n i1

SXX (x i x) 2 698, 56;


i 1
n

1
yi 29, 0328;
n i1

(yn)2

xy

1
x i yi 320,3388;
n i 1

1 n
(yi y) 2 224, 237.

n i1

T L ca cc h s l
xy x y
5,115 .
b
2, 9027; a y bx
SXX / n
Ta thu c phng trnh :

Y 5,115 2,9027x .
L ca 2 c th tnh theo 2

(5.1.32)
1 n
(yi y i )2 . Tuy nhin
n 2 i 1

trc ht ta tm h s xc nh:

R2

SSR n
(y i y) 2 / (yi y) 2 0.964 .
SST i 1
i 1

y l gi tr kh ln. Ta ni c 96,4% s liu c gii thch


bi m hnh. Theo (5.1.31) th
2

n
1 n
(y i y i ) 2
(1 R 2 )(yn)2 9,5696 3, 09342 .

n 2 i 1
n 2

By gi ta kim nh h s b 0 . Theo (5.1.15),


se(b)

b 0 2,9027
2
0.1179 Tb

24,80 .

SXX
0,1179
se(b)

P gi tr ca phn b Student 23 bc t do ng vi gi tr 24,80


l 0,000. Vy ta chp nhn gi thuyt b 0 .
By gi ta xt phn tch phng sai.
225

SSR (y i y) 2 5885,9 SSR / 1 5885,9 ,


i 1
n

SSE (yi y i ) 2 220,1 2


i 1

SSE
9,569
n 2

SST (y i y) 2 6105, 9.
i1

SSR / 1
615, 08
SSE / (n 2)

P - gi tr ca phn b F(1, 23) ng vi gi tr 615,08 bng 0,000


nn ta cng kt lun b 0 .
Cc kt qu tnh ton trn c c ng li vo trong bng phn
tch h s v phn tch phng sai. Thng thng cc phn mm
thng k u a ra cc bng ny (xem Bng 5.3).
Bng 5.3. Phn tch h s v phn tch phng sai cho V d 5.2
R
.982

R Square
.964

Regression
Residual
Total

Constant
X1

Adjusted R Square
.962

Sum of Squares
5885.852
220.093
6105.945
Unstandardized
Coefficients
Std.
B
Error
5.115
1.146
2.903
.117

df
1
23
24

Std. Error of the Estimate


3.0934

Mean Square
5885.852
9.569

F
615.080

Sig.
.000

95% Confidence Interval for B


t
4.464
24.801

Sig.
.000
.000

Lower Bound

Upper Bound

2.744
2.661

7.485
3.145

Ta lp th ri im ca cc phn d chun ha
di e i / theo y i nh Hnh 5.6. Nhn vo th ta thy c 1 s liu
nm ngoi di [-2; 2]. Phn d chun ha phn b kh u n trong
di [-2; 2], duy ch c 1 gi tr nm ngoi di ny (t l vi phm l
1/25, nh hn 5% nn chp nhn c).
Tm li, chng ta chp nhn m hnh (5.1.32).
226

3
2
1
0
-1

20

40

60

80

-2
-3

Hnh 5.6. th phn d chun ha cho s liu ko

By gi mt dy c di 8 s c sc ko trung bnh l

y (8) 5,115 2,9027.8 28, 336


Theo (5.1.27), khong tin cy 90% ca L ny l
(28,336 1.062) (27, 274; 29,398) . Theo (5.1.29), khong tin cy
90% cho quan st tng lai khi dy c di 8 l
(28,336 5, 407) (22.929; 33.743) .
#
5.1.7. Tuyn tnh ha mt s m hnh
Dng php bin i loga vi bin hi quy hay bin phn hi,
hoc vi c hai, dng php nghch o vi bin hi quy ..., ta c th
a mt s m hnh v dng tuyn tnh.
Hi quy logarith

y a b.ln x

Hi quy m

y a.eb.x ( ln y ln a b ln x)

Hi quy ly tha
Hi quy nghch o

y a . x b ( ln y ln a b ln x)
y a b.(1/ x)

Hi quy tam thc

y a bx cx 2

Chng hn, khi cn dng hi quy m, trong phn chn m hnh


ta n Exp (3) ; mi thao tc khc tng t.

227

S dng my tnh b ti. Chng ta m t ngn gn cch s


dng my tnh b ti CASIO fx-500MS tnh ton hi qui. Du
rng nhng kt qu cn s lc so vi cc phn mm chuyn dng,
song chng cng gip ta nht nh trong cng vic.
Xo nh thng k

SHIFT

Gi chng trnh tnh

MODE

Chn m hnh

Lin[1]

MODE

REG[3]

Nhp d liu. Chng hn, cn nhp d liu V d 5.1 ta n

45

24.2

C th ta nhp cho ht d liu.


Gi kt qu. Nhp d liu xong th gi kt qu. Vic gi kt qu
vi bin x hoc y: x i2 , x i , x, s X , s X , yi2 , yi , y, s Y , s Y
vn tin hnh nh vi thng k 1 bin nu cui mc 4.1.2. Bng
5.4 a ra vi tnh ton nh vy cng nh mt s tnh ton khc.
Bng 5.4. Mt s thao tc phn tch hi quy trn my tnh b ti
Lng
cn tnh

Kt
qu

x iy i

SHIFT

S SUM

sY

SHIFT

S VAR

yn [2]

s Y

SHIFT

S VAR

yn 1 [3]

a
b

SHIFT

S VAR

A [1]

32,543

SHIFT

S VAR

B [2]

-0.170

rXY

SHIFT

S VAR

r [3]

-0.964

x (20)
y (70)

xy [3]

9,265

1,762

x [1]

1,904

20 SHIFT

S VAR

73.78

70 SHIFT

S VAR y [2]

20.64

Sau khi c gi tr rXY , dng (5.1.31) ta tnh c L cho sai


s chung 2 ; tip theo ta c th tnh c Ta , Tb , ...
228

5.2. M HNH HI QUY TUYN TNH BI


MHHQ tuyn tnh bi l s m rng t nhin ca MHHQ tuyn
tnh n. Chng ta ghi ra di y nhng kt qu tm tt.
5.2.1. Phng trnh hi quy
a) Dng quan st v dng ma trn
Gi s mi quan h gia bin ph thuc (bin phn hi) Y v k
bin c lp (bin hi quy) x1,..., x k cho bi m hnh

Y 0 1x1 ... k x k

(5.2.1)

trong 0 , 1 ,..., k l cc tham s cha bit, gi l cc h s hi


quy, 0 gi l h s chn, 1,..., k l cc h s gc; l sai s ngu
nhin c k vng 0 v phng sai 2 .
Khi khng s nhm ln, ta vit ngn gn (5.2.1) di dng
(5.2.2)

E[Y | x1,..., x k ] 0 1x1 ... k x k

hay n gin hn na
(5.2.3)

E[Y] 0 1x1 ... k x k

tm hiu m hnh (5.2.1) chng ta tin hnh n quan st v ghi


li kt qu di dng bng nh Bng 5.5.
Bng 5.5. S liu cho m hnh hi quy bi

y
y1
.
yn

x1

x2

xk

x11
.
x n1

x12
.
x n2

.
.
.

x1k
x nk

Nh vy, di dng quan st, m hnh (5.2.1) vit li di dng


y1 0 1x11 ... k x1k 1

. . . . . . . . . . . .
y x ... x
0
1 n1
k nk
n
n

(5.2.4)

229

thun li cho k hiu v cc phn tch tip theo, chng ta s


dng cc k hiu ma trn sau y.
y1

y . ;
y n

1 x11 x12 . . . x1k

X . . . . . . . . . . .
1 x n1 x n2 . . . x nk

0

. ;
k

1

.
n

Khi , phng trnh (5.2.4) c vit li di dng ma trn


y = X + ,

(5.2.5)

trong y l n - vc t quan st, X l ma trn cp n p ca cc bin


c lp ( p k 1 ) - cn gi l ma trn k hoch - l p - vc t cc
h s hi quy, l n - vc t sai s ngu nhin.
b) Tuyn tnh ha mt s m hnh
M hnh (5.2.3) l tuyn tnh v n tuyn tnh vi cc tham s i .
Trong ng dng chng ta thng gp m hnh dng
E[Y] 1g1 (x1 ,..., x ) .... p g p (x1 ,..., x ) (5.2.6)

trong g1,..., g p l cc hm no ca cc bin hi quy x1,..., x .


y l m hnh tuyn tnh vi cc tham s i , phi tuyn vi cc
bin x1 ,..., x . Xt php i bin
z1 g1 (x1,..., x );...; z p g p (x1,..., x ).

Ta c th a (5.2.5) v dng thng thng


E[Y] 1z1 ... p z p

(5.2.7)

l m hnh tuyn tnh vi c tham s ln cc bin hi quy. Nh vy t


nay ta vn gi m hnh (5.2.6) l tuyn tnh. Xt mt s trng hp
c bit.
230

b1. Hi quy a thc. Xt m hnh

E[Y] a 0 a1x ... a k x k .


t z1 x; ...; zk x k , ta a m hnh ny v dng
E[Y] a 0 a1z1 ... a k z k .

c bit, ngi ta hay xt m hnh tam thc v a thc bc ba:


E[Y] a cx cx 2 ,
E[Y] a cx cx 2 dx 3.

b2. M hnh a thc bc 2 ca hai bin. l m hnh


E[Z] a bx cy dx 2 exy fy 2 .

y l m hnh tuyn tnh vi 6 tham s a, b, c, d, e, f. Trng


hp gi thuyt e 0 b bc b, ta ni hai bin hi quy x v y l tng
tc vi nhau, m hnh c cha s hng tch cho xy. Tri li, nu
e 0 , ta ni m hnh khng cha s hng tch cho xy, 2 bin x v y
l khng tng tc vi nhau.
b3. Dng php bin i loga vi bin phn hi
Gi s bin phn hi Y biu din di dng hi quy m:
Y Ae1x1...k x k . ,

trong A, 1, ..., k l cc tham s, l sai s ngu nhin dng


nhn.
Logarit ha ta c
Z ln Y ln A 1x1 ... k x k ln
0 1x1 ... k x k ,

(0 ln A; ln )

l m hnh tuyn tnh thng thng.


Ngi ta cng dng php bin i loga vi cc bin hi quy,
hoc vi c bin phn hi ln cc bin hi quy c cc m hnh
tuyn tnh ha (xem [1], [9],).
231

b4. Hi quy c cha sin, cos.


Gi s bin ph thuc c dng

Y(t) a bt c sin t d cos t .


Bng cch t x1 t; x 2 sin t; x 3 cos t , ta a m hnh v
dng tuyn tnh thng thng.
5.2.2. c lng h s hi quy v tnh cht ca L
Gi thit u tin cn c l ma trn X c s hng t nht bng s
ct, p k 1 n , v hng ca n bng s ct:

Rank(X) p.

(5.2.8)

Khi , L lm cc tiu tng bnh phng cc sai s


n

L() 2i ( y - X)T ( Y - X)
i 1

gi l L bnh phng cc tiu, k biu l , cho bi:


( XT X)1 X T y .

(5.2.9)

Ging nh (5.1.14), L cho sai s chung ca m hnh l


2
vi

1 n 2
1 n
ei
(yi y i )2
n p i 1
n p i 1

(5.2.10)

y i 0 1x i1 ... k x ik : d bo ca quan st th i

ei y i y i

phn d th i.

Nhn thy v phi ca (5.2.10) c cha mu s n p . Vy, khi


s bin hi quy p tng ln, (chng hn vi hi quy a thc, khi s bc
ca a thc tng) c th sai s m hnh tng ln. Ta s c m hnh
cc ti nu p n.
nghin cu cc tnh cht ca L tham s, ging vi trng
hp c 1 bin hi quy, cn c gi thit:
1,..., n c lp, cng phn b chun N(0; 2 ) . (5.2.11)

232

nh l 5.2. Vi cc gi thit (5.2.8), (5.2.11) th:


i) l L khng chch ca vc t tham s :

E[ ] .

ii) Ma trn covarian ca cho bi:


Cov( ) ( XT X)1 2 .

iii) 2 theo (5.2.10) l L khng chch ca 2 :


E[ 2 ] 2 .

5.2.3. Kim nh gi thuyt


a) Kim nh ngha ca hi quy. l kim tra xem c mt quan h
tuyn tnh no gia bin phn hi Y vi mt tp con no ca
cc bin hi quy x1,..., x k hay khng. C th l xt bi ton kim
nh:
H 0 : 1 2 ... n 0 / H1 : j 0

vi

nht

mt

j {1,..., k} .
Nu H 0 b bc b th c ngha l t ra mt trong cc bin hi
quy x1,..., x k c ngha i vi m hnh.
Di gi thuyt H 0 c th chng minh tng bnh phng hi
quy v tng bnh phng cc sai s theo (5.1.24) l nhng BNN c
lp v c bc t do tng ng l k v n p . Th th (xem nh l
3.23)

F0

SSR / k
MSR

F(k; n p) .
SSE / (n p) MSE

(5.2.12)

T gi thuyt b bc b mc nu F0 f (k; n p) .
Cc phn mm thng dng Pgi tr v a ra bng phn tch
phng sai cho th tc va nu.
Ngi ta cng xt kim nh cho mt tp con ca cc h s
0 , 1,..., k bng 0. Chi tit xem [1], [9].
233

2
b) H s xc nh bi R 2 v h s xc nh hiu chnh Radj

Vi m hnh hi quy nhiu bin nh ngha h s xc nh bi


R v cc tnh cht ca n nh vi trng hp hi quy n:
SS
SS
R2 R 1 E .
SS T
SS T
2

Tnh cht c bit ca h s xc nh l n khng gim khi tng


s bin hi quy. T , h s xc nh kh ni cho ta bit vic tng
bin c li g hay khng, nht l khi s gia tng h s xc nh l
nh. V th nhiu nh phn tch li thch dng h s xc nh hiu
chnh (adjusted R 2 ):
R 2adj 1

SS E / (n p)
.
SS T / (n 1)

(5.2.13)

Mu v phi l hng s, cn t l c lng ca sai s; n b


nht khi v ch khi h s xc nh hiu chnh R 2adj ln nht. T ,
mt quy tc la chn bin hi quy l:
Chn mt s trong cc bin hi quy x1 ,.., x k R 2adj ln nht.
c) Kim nh mt tham s trit tiu (kim nh T).
Xt bi ton kim nh mt tham s n l no trit tiu:
H 0 : j 0 / H1 : j 0

( j 0,1,..., k) .

Nu gi thuyt khng b bc b th c ngha rng bin hi quy


tng ng khng b loi khi m hnh. Thng k kim nh l
Tj

j
j

se( j )
2 C jj

(5.2.14)

trong C jj l phn t th j ca ng cho chnh ca ma trn


C ( XX)1 ng vi j .

V Tj T(n p) nn gi thuyt b bc b nu Tj t /2 (n p) .
234

5.2.4. c lng v d on
a) Khong tin cy cho tham s n l
Khong tin cy 100(1 )% cho tham s j cho bi

j t /2 (n p)se( j ),

(se( j ) 2C jj ) .

(5.2.15)

b) Khong tin cy cho p ng trung bnh.


Gi s quan st tng lai thc hin ti mc x 01,..., x 0k ca cc
bin hi quy x1,..., x k . t x 0 (1, x 01, ..., x 0k )T . p ng trung
bnh ti im ny l E[Y | x 0 ] x 0T 0 1x 01 ... k x 0k , L
im ca n l
y 0 x 0T 0 1x 01 ... k x 0k .

i vi MHHQ tuyn tnh bi, khong tin cy 100(1 )% cho


p ng trung bnh ti im x 01,..., x 0k l

y 0 t /2 (n p) 2 x 0T ( X T X)1 x 0

(5.2.16)

c) D on cho quan st mi. L im ca d on cho quan st


tng lai ti mc x 01,..., x 0k ca cc bin c lp l
y 0 = x 0T 0 1x 01 ... k x 0k .

Khong d on 100(1 )% cho quan st tng lai ny l

y 0 t /2 (n p) 2 (1 x 0T ( XT X) 1 x 0 ) . (5.2.17)
d) Vn ngoi suy vi m hnh hi quy bi
Vn c nhng ch tng t nh vi hi quy n, song vn
cn thn trng hn. Chng hn, vi m hnh c hai bin hi quy x, y
min bin thin ca cc bin hi quy Hnh 5.7 phi hiu l elip ch
khng phi hnh ch nht ABCD. Tnh hnh s kh khn hn khi s
bin hi quy tng ln.

235

Hnh 5.7. Min bin thin ca cc bin hi quy

5.2.5. Phn tch phn d


Vi m hnh bi, ngi ta cng tin hnh lp th phn d
chun ha d i ei / nh vi m hnh n. Nu c khng qu 95%
cc gi tr di nm trong di (-2; 2) v phn d c dng iu tng
i u n quanh trc honh nh Hnh 5.5a th chp nhn m
hnh. Tri li, phi tin hnh phn tch li. Ngi ta cng kim tra
tnh chun ca phn d bng t chc hay th P-P chun nh
mc 4.7.1.
Tuy nhin, c hai im khc bit. Th nht, ngoi lp th
phn d chun ha theo thi gian (theo ch s i), theo chiu tng ca
mt vi bin hi quy x i no , theo chiu tng ca d bo y i , khi
xt m hnh vi mt nhm con cc bin hi quy, ngi ta cn lp
th phn d theo bin hi quy cha tham gia vo m hnh. Nu pht
hin ra th phn d chun ha theo bin ny khng t yu cu th
c nhiu kh nng bin hi quy cn phi tham gia vo m hnh.
Th hai, thay cho th phn d chun ha d i , ngi ta thy
rng th phn d iu chnh ri (cn gi l phn d student ha
(studentized residual)) u vit hn, trong
ei
ri
,
(5.2.18)
2
(1 h ii )
vi h ii l phn t cho th i ca ma trn
H X(X T X) 1 XT .

236

(Lu rng 0 h ii 1 d i ri ).
5.2.6. S dng phn mm
Cc phn mm thng k ngy nay cho php phn tch m hnh
vi s bin hi quy ln n hng ngn v s quan st ln n hng
chc vn. Chng ta cn c nhng kin thc c bn tn dng nhng
li th ca cc phn mm ny. Mi phn mm c nhng th mnh
ca n, song chng u c phn phn tch h s v phn tch phng
sai. Chng ta tm hiu s b qua mt vi v d.
V d 5.3 ( Phn tch s liu lc ko). Chng ta ly li v d lc
ko V d 5.2. Gi s chng ta nhp s liu vo ca s bin tp
d liu. Sau y l mt s thao tc c bn.
Bng 5.5. Kt qu x l vi s liu lc ko dy dn
TT

Lc ko

di

cao

D bo

Phn d

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

yi
9.95
24.45
31.75
35.00
25.02
16.86
14.38
9.60
24.35
27.50
17.08
37.00
41.95
11.66
21.65
17.89
69.00
10.30
34.93
46.59
44.88
54.12
56.63
22.13
21.15

x1
2
8
11
10
8
4
2
2
9
8
4
11
12
2
4
4
20
1
10
15
15
16
17
6
5

x2
50
110
120
550
295
200
375
52
100
300
412
400
500
360
205
400
600
585
540
250
290
510
590
100
400

y i
8.38
25.60
33.95
36.60
27.91
15.75
12.45
8.40
28.21
27.98
18.40
37.46
41.46
12.26
15.81
18.25
64.67
12.34
36.47
46.56
47.06
52.56
56.31
19.98
21.00

ei
1.57
-1.15
-2.20
-1.60
-2.89
1.11
1.93
1.20
-3.86
-.48
-1.32
-.46
.49
-.60
5.84
-.36
4.33
-2.04
-1.54
.03
-2.18
1.56
.32
2.15
.15

Phn d chun
ha d i

.687
-.501
-.963
-.698
-1.265
.487
.843
.523
-1.689
-.208
-.578
-.202
.215
-.263
2.553
-.158
1.894
-.890
-.674
.013
-.953
.681
.141
.939
.067

237

Chn chng trnh phn tch: Analyze / regression / linear.


Chn bin: T danh sch cc bin, y bin y sang bin ph
thuc (Dependent), y hai bin x1, x2 sang bin c lp
(Independent(s)).
Phng php lc m hnh: Trong phng php (Method) ta
chn enter. Phn mm s lc m hnh c tt c cc bin.
Tm L cho tham s v khong tin cy ca chng: Statistics /
chn Estimates v Confidence intervals / Continue.
Lp th phn d chun theo y i : Plots / y bin ph thuc
(DEPENDENT) sang X, y bin phn d chun ha (ZRESID)
sang Y; mun c th xc sut chun chn thm Normal
probability plot / Continue.
Lu d bo y i , phn d ei , phn d chun ha di vo danh
sch cc bin: Save/ trong mc gi tr d bo (Predicted Values) chn
Unstandardized, trong mc phn d (Residuals) chn Unstandardized
v Standardized / Continue.
Chy chng trnh: OK
Chi tit v phn mm SPSS c th xem [4]. Vi cc thao tc
trn, d bo cho lc ko, phn d, phn d chun c ghi cc ct
5,6,7 ca Bng 5.5. Cc bng tm tt, phn tch phng sai, phn tch
h s cho Bng 5.6.
Bng 5.6. Tm tt, phn tch phng sai v phn tch h s cho V d 5.3
R
.991

Regression
Residual
Total

Constant
X1
X2

238

R Square
.981

Adjusted R Square
.979

Sum of Squares
5990.771
115.173
6105.945
Unstandardized
Coefficients
B
Std. Error
2.264
1.060
2.744
.094
.013
.003

df
2
22
24

t
2.136
29.343
4.477

Std. Error of the Estimate


2.28805

Mean Square
2995.386
5.235

Sig.
.044
.000
.000

F
572.167

Sig.
.000

95% Confidence Interval for B


Lower Bound
.065
2.550
.007

Upper Bound
4.462
2.938
.018

Ta thy h s xc nh R 2 0, 981 , vy c 98,1% s liu c


gii thch bi m hnh; y l mt t l kh ln. L cho phng sai
chung ca m hnh l 2 2, 28812 . Mc ngha ca thng k F l
0,000, rt nh so vi 0,01: M hnh c tc dng tt gii thch s
liu. Tt c cc mc ngha ca thng k T ca cc tham s u nh
hn 0,05 ( gi tr cc i 0,044 ng vi bin hng s). Hu qu l
khong tin cy ca tt c cc h s u khng cha gc ta . Nh
vy, cc kim nh T khng bc b m hnh. M hnh d tuyn l

Y 2, 264 2, 744x1 0, 013x2

(*)

1.00

2
1
.50

0
0

15

30

45

60

75

-1
-2

0.00
0.00

.50

1.00

Hnh 5.8. th xc sut chun v phn d chun ha ca s liu lc ko

th xc sut chun v th phn d chun th hin Hnh


5.8. Mc du khng phi rt st, song sai lch ca th xc sut
chun vi ng thng y x l c th chp nhn c. th phn
d chun ha b tr kh u dn, i xng trong di [-2; 2]. Tuy
nhin 1 quan st (th 15) c tr tuyt i phn d chun vt qu 2.
D sao, t l 1/ 25 l nh hn 5% v c th chp nhn c. Tm
li, cc kim nh u khng bc b m hnh (*).
Nh vy, vi s liu lc ko ta c ti 2 m hnh c chp
nhn: m hnh (5.1.32) V d 5.2 v m hnh (*) va nu. Do s
dng nhiu bin hn, h s xc nh ca m hnh (*) ln hn. V li,
m hnh (*) khng phi l qu phc tp, chng ta chn n lm m
hnh cui cng.
#
239

5.3. LA CHN BIN V XY DNG M HNH


5.3.1. La chn bin
Vn quan trng trong ng dng ca phn tch hi quy l la
chn tp hp cc bin hi quy xy dng m hnh. i khi nhng
kinh nghim hay nhng hiu bit v mt l thuyt c th gip nh
phn tch nh ra c tp cc bin hi quy s dng trong nhng tnh
hung c th. Nhiu khi vn li ch, ngi ta bit rt r cc bin
quan trng, nhng li khng chc rng c phi tt c cc bin d
tuyn u l cn thit cho mt m hnh tha ng hay khng.
Nh vy xut hin vn la chn bin hi quy: La chn ra
trong cc bin d tuyn mt tp con cc bin tt nht theo cc
ngha sau y.
+ Kh nng ng dng: Chn bin hi quy vic s dng a
dng ca m hnh (d on, c lng) cho kt qu tha ng.
+ Tnh kim: m hnh vi gi thp chp nhn c v d s
dng, ngi ta mun m hnh t bin hi quy nht c th.
Tuy nhin, hu nh chng c m hnh no tt nht theo ngha
p ng ng thi nhiu tiu chun nh trn. Nhng nh gi, nhng
kinh nghim t x l h thng ang xem xt thng l tr lc cn
thit cho vic la chn tp bin hi quy.
Khng c thut ton no lun lun a ra li gii tt cho vn
la chn bin. Mc du ngi ta a ra rt nhiu thut ton la
chn, song chng ch n kha cnh k thut, cn c s lin kt
cht ch vi nh phn tch. Chng ta s m t ngn gn mt s k
thut thng dng nht vi vn chn bin.
Gi s c K bin d tuyn x1,..., x K v mt bin phn hi y. Tt
c cc m hnh u c h s chn 0 , vy m hnh c c thy K 1
s hng. Chng ta cng gi s dng hm ca cc bin d tuyn
(chng hn x1 1 / x, x 2 ln x... ) l ng.
a) Th tc cn nhc tt c. Ton b cc m hnh c th u c
xem xt. Ta s cn so snh 2K m hnh hi quy. Mc du vic phn
tch 1 m hnh khng l vn vi cc phn mm ngy nay, song khi
240

K tng i ln, s phng trnh cn cn nhc s tng ln nhanh


chng (vi K 10, 2 K 1024 ).
2
b) Da vo R 2 hoc Radj
. Ngi ta xut pht t m hnh c t bin

n m hnh c nhiu bin hn. Nu s gia tng R2 khng ng k


th dng li v la chn m hnh tng ng.
Tiu chun da vo R 2adj thng tt hn. Chn m hnh c

R 2adj cc i hoc gn cc i (nu mun s bin hi quy nh).


c) Tiu chun PRESS. Gi y (i) l d on ti quan st th i da vo
m hnh ch c n - 1 quan st cn li. t
n
n e

PRESS (yi y (i) ) 2 i


i 1
i 1 1 h ii

trong ei yi y i l phn d thng thng.


M hnh c PRESS nh l m hnh c ngh.
d) Th tc cn nhc tng bc (stepwise procedure)
Sau y chng ta dng k hiu fin (tng ng faut ) ch gi tr
c th ca thng k F ring phn sau khi b i (tng ng thm vo)
mt bin hi quy khi m hnh.
u tin chn m hnh mt bin hi quy m c h s tng quan
cao nht vi bin phn hi Y. y cng l bin c thng k f ln
nht. Chng hn chn c bin x1 bc th nht.
Gi s bc no la chn c m bin, chng hn
x1 ,..., x m . bc tip theo, xt cc m hnh vi m bin la chn
x1 ,..., x m v 1 bin trong cc bin cn li. Nu thng k f ring phn
tng ln, quay li xt xem nu b mt trong m bin x1 ,..., x m th
thng k f ring phn c tip tc c tng ln hay khng. Nh vy
ta tng thm hoc tng thm v b i bin nu fin faut . Th tc
dng li n khi khng c bin no c thm vo hoc b i.
241

e) Th tc tin (forward procedure). Ti mt bc no a thm


vo tp bin la chn trong cc bin cn li mt bin lm tng thng
k F ring phn nhiu nht. Nu khng c bin no nh vy th dng
qu trnh la chn bin.
Nh vy, khc vi th tc cn nhc tng bc, th tc tin mc
nhin cng nhn cc bin la chn cc bc trc l tt. Thc ra,
khi c bin mi thm vo tp chn, cc bin c c th tr nn ti v
cn phi loi b nh th tc cn nhc tng bc; th tc cn nhc
tng bc l u vit hn. Tuy nhin, nhiu v d ch ra rng, hai th
tc va nu cho ra cng mt tp chn cc bin hi quy.
f) Th tc li (backward procedure). Th tc bt u vi ton b K
bin hi quy. Bin hi quy vi thng k f ring phn nh nht s b
loi b nu thng k f ring phn ny c ngha, tc l f f aut .
Tip tc n khi khng c bin hi quy no b loi.
g) Vi nhn xt v la chn m hnh cui cng. Tiu chun ch yu
la chn bin l cn nhc tng bc. C th c mt vi m hnh
tt nh nhau. Khi ta c th cn nhc thm cc tiu chun khc.
Nu s bin hi quy khng ln, c th dng th tc cn nhc tt c.
Sau khi la chn c bin hi quy, vn phi tin hnh cc kim
tra thng thng: phn tch phn d, kim tra s ph hp , xem xt
v mt l thuyt nh c nht thit phi cha tch cho, nht thit phi
cha bin hi quy no , du ca bin no nht thit phi dng
(hay m) hay khng.
5.3.2. Nhng kha cnh khc ca kim nh m hnh.
a) a cng tuyn. Chng ta nh rng gi thit (5.2.8) rng hng ca
ma trn k hoch X phi bng s tham s p. iu ny tng ng
vi det( X X) 0 . Tuy nhin iu g xy ra nu det( X X) 0 .
Nu xy ra det( XX) 0 th c quan h tuyn tnh mnh gia
cc ct ca ma trn X, tc l c s ph thuc tuyn tnh mnh gia
cc bin hi quy 1, x1,..., x k . Ta ni xy ra hin tng a cng
tuyn (multicollinearity). a cng tuyn c th gy ra nhng hu qu
tai hi v L cc h s hi quy nh phng sai, hip phng sai ca
cc L tham s tr nn ln, t s T mt ngha trong khi R 2 c th
242

cao, du ca h s hi quy c th sai cng nh sai lm trong s


dng m hnh ni chung. Nhiu ti liu nu ra cch pht hin a
cng tuyn cng nh cch khc phc (xem [1], [9], ).
b) Phng sai ca sai s thay i
Cho n gi, tr trng hp tm L cho cc tham s, tt c cc
th tc phn tch u da vo gi thit (5.2.11). Tuy nhin, nu gi
thit ny khng tha mn; c bit, gi thit cng phng sai 2 ca
cc sai s b vi phm, ta ni xy ra trng hp phng sai ca sai
s thay i. Nu ta vn s dng cc phng php x l thng thng
th c th chng minh c L thu c l chch v khng hiu qu.
C th pht hin phng sai sai s thay i bng th: th
phn d chun ha theo mt bin no (theo ch s i, theo bin hi
quy xi no hoc theo y i ) c dng (b) (c) hay (d) Hnh 5.5.
Cng c th dng mt s tiu chun v lng nh tiu chun tng
quan hng Spearman, kim nh Gleiser Khc phc hin tng
phng sai thay i ch yu dng phng php bnh phng ti
thiu trng lng, dng php bin i loga (xem thm [1], [9]).
c) C s tng quan chui gia cc sai s. Xem [1], [9].
V d 5.4. Mt bi bo trn Tp ch Dc hc (Journal of
Pharmaceuticals Sciences - 1991) a ra d liu v ha tan t s
mol quan st ca mt cht tan ti nhit khng i vi cc tham s
tan ring phn phn tn, lng cc v lin kt hydro Hansen. S liu
Bng 5.7, trong Y l logarit m ca ha tan t s mol, x1 l
ha tan ring phn khuych tn, x 2 l ha tan ring phn
lng cc, x 3 l ha tan ring phn lin kt hydro.
Trc ht chng ta lc m hnh a thc bc hai y

Y b 0 b1x1 b 2 x2 b 3x3 b12 x1x 2 b13x1x 3 b 23x2 x3


b11x12 b 22 x 22 b33x32
Cc kt qu phn tch sau da vo phn mm SPSS. H s xc
nh R 2 0.917 v h s xc nh hiu chnh R 2Adj 0,870 kh ln,
sai s chung ca m hnh 2 0, 069232 kh nh, mc ngha ca
243

Bng 5. 7. S liu tan

TT

x1

x2

x3

1
2
3
4
5

0.222
0.395
0.422
0.437
0.428

7.3
8.7
8.8
8.1
9

0
0
0.7
4
0.5

0
0.3
1
0.2
1

6
7
8
9
10

0.467
0.444
0.378
0.494
0.456

8.7
9.3
7.6
10
8.4

1.5
2.1
5.1
0
3.7

2.8
1
3.4
0.3
4.1

11
12
13
14
15

0.452
0.112
0.432
0.101
0.232

9.3
7.7
9.8
7.3
8.5

3.6
2.8
4.2
2.5
2

2
7.1
2
6.8
6.6

16
17
18
19
20

0.306
0.0923
0.116
0.0764
0.439

9.5
7.4
7.8
7.7
10.3

2.5
2.8
2.8
3
1.7

5
7.8
7.7
8
4.2

21
22
23
24
25

0.0944
0.117
0.0726
0.0412
0.251

7.8
7.1
7.7
7.4
7.3

3.3
3.9
4.3
6
2

8.5
6.6
9.5
10.9
5.2

26

0.00002

7.6

7.8

20.7

thng k F l 0,000. Vy m hnh gii thch tt d liu. Tuy nhin,


tt c mc ngha (P-gi tr) ca cc h s u ln hn 0,05 (gi tr
nh nht l 0,087 ng vi bin x 3 , gi tr ln nht l 0,719 ng vi
bin x 2 x3 ). Hu qu l, tt c cc khong tin cy 95% ca cc h s
u cha gc ta . (Xem Bng 5.8). Ta phi tm m hnh khc.
By gi chng ta dng th tc cn nhc tng bc (stepwise
prosedure) la chn bin. Phn mm dng li 3 bin la chn,
l x 3 , x1 v x 22 (tt nhin c bin hng s). Bng 5.9 sau y ch ra
tm tt bt qu, phn tch phng sai, phn tch h s ca m hnh
la chn.
244

Nhn thy rng h s xc nh R 2 0,886 tuy thua km trng


hp c y cc bin l 0,917, song h s xc nh hiu chnh
(quan trng hn) l R 2Adj 0,870 li khng thua km trng hp c
y cc bin. Sai s chun ha ( 0, 0609 ) cng nh mc ngha
ca thng k F ( 0, 000 ) xem l nh nhau vi 2 m hnh. Tuy nhin,
i vi m hnh sau, tt c cc mc ngha ca thng k T ng vi
cc bin la chn u nh hn 0,05 (cc i bng 0,0320, tt c cc
khong tin cy 95% u khng cha gc ta .
Bng 5. 8. Tm tt, phn tch phng sai v phn tch cc h s
cho m hnh y ca s liu tan
R
0.958

Regression
Residual
Total

Constant
X1
X2
X3
X1X2
X1X3
X2X3
X1B
X2B
X3B

R Square
.917
Sum of Squares
.656
.059
.715
Unstandardized
Coefficients
Std.
B
Error
-1.769
1.287
.421
.294
.222
.131
-.128
.070
-.020
.012
.009
.008
.003
.007
-.019
.017
-.007
.012
.001
.001

Adjusted R Square
.870
df
9
16
25

Std. Error of the Estimate


.060923263

Mean Square
.073
.004

F
19.628

Sig.
.000

95% Confidence Interval for B


t
-1.375
1.430
1.701
-1.822
-1.651
1.201
.366
-1.150
-.618
.572

Sig.
.188
.172
.108
.087
.118
.247
.719
.267
.545
.575

Lower Bound

Upper Bound

-4.498
-.203
-.055
-.277
-.045
-.007
-.012
-.055
-.033
-.002

.959
1.044
.500
.021
.006
.025
.017
.016
.018
.004

Lu . Dng th tc tin (forward prosedure) cho kt qu trng


vi kt qu t th tc cn nhc tng bc. Nu dng th tc li
(backward prosedure), khong tin cy ca h s ca m hnh cui
cng c cha gc ta . Nu dng th tc loi bin tng bc
(remove prosedure) m hnh cui cng ch cha bin hng s, khng
th dng d bo c.
Nh vy, qua khu la chn bin chng ta c
245

Y 0,304 0, 083x1 0, 031x 3 0, 004x 22 .

(*)

Bng 5.9. Tm tt, phn tch phng sai, phn tch h s ca m hnh
cui cng theo phng php cn nhc tng bc ca s liu tan
R
0.941

R Square
.886

Regression
Residual
Total

Sum of Squares
.633
.082
.715
B

Constant
X3
X1
X2B

Adjusted R Square
.870

-.304
-.031
.083
.004

Std.
Error
.132
.004
.015
.001

df
3
22
25

Std. Error of the Estimate


.060973528
Mean Square
.211
.004

Sig.

-2.292
-7.156
5.564
3.205

.032
.000
.000
.004

F
56.778

Sig.
.000

95% Confidence Interval for B


Lower Bound
Lower Bound
-.578
-.029
-.041
-.022
.052
.113
.002
.007

3
2
1
0
-1
-2

Hnh 5.9. Phn d chun ha theo quan st ca s liu tan

Kim tra phn d ca m hnh ny. Chng hn theo ch s i ta


thy c 2 gi tr phn d chun ha (ng vi quan st th 6 v th
10) vt qu 2; vi phm th hai l d i kh nh ti cc quan st 11
24. D sao 2 vi phm ny cng khng n ni no. Phn d chun
ho xp theo x1 , x 2 hay y u khng c vi phm ng k. Chng ta
la chn (*) lm m hnh cui cng.
#

246