statistika (kmi/pstat) - cvicení dvanácté aneb regrese a...

43
Statistika (KMI/PSTAT) Cviˇ cen´ ı dvan´ act´ e aneb Regrese a korelace Statistika (KMI/PSTAT) 1 / 18

Upload: others

Post on 25-Mar-2021

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Statistika (KMI/PSTAT)Cvicenı dvanacte

anebRegrese a korelace

Statistika (KMI/PSTAT) 1 / 18

Page 2: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Uvod do regresnı analyzy

V souboru 25 jedincu jsme merili jejich vysku a hmotnost. Vysledky jsou v tabulce a grafu.

resp. c. 1 2 3 4 5 6 7 8 9 10 . . .vyska [cm] 164 178 187 182 161 183 190 160 193 183 . . .hmotnost [kg] 60 79 91 77 57 86 87 56 103 80 . . .

Statistika (KMI/PSTAT) 2 / 18

Page 3: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Uvod do regresnı analyzy

V souboru 25 jedincu jsme merili jejich vysku a hmotnost. Vysledky jsou v tabulce a grafu.

resp. c. 1 2 3 4 5 6 7 8 9 10 . . .vyska [cm] 164 178 187 182 161 183 190 160 193 183 . . .hmotnost [kg] 60 79 91 77 57 86 87 56 103 80 . . .

Statistika (KMI/PSTAT) 2 / 18

Page 4: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Uvod do regresnı analyzy

V souboru 25 jedincu jsme merili jejich vysku a hmotnost. Vysledky jsou v tabulce a grafu.

resp. c. 1 2 3 4 5 6 7 8 9 10 . . .vyska [cm] 164 178 187 182 161 183 190 160 193 183 . . .hmotnost [kg] 60 79 91 77 57 86 87 56 103 80 . . .

Statistika (KMI/PSTAT) 2 / 18

Page 5: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Uvod do regresnı analyzy

V souboru 25 jedincu jsme merili jejich vysku a hmotnost. Vysledky jsou v tabulce a grafu.

resp. c. 1 2 3 4 5 6 7 8 9 10 . . .vyska [cm] 164 178 187 182 161 183 190 160 193 183 . . .hmotnost [kg] 60 79 91 77 57 86 87 56 103 80 . . .

Statistika (KMI/PSTAT) 3 / 18

Page 6: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Uvod do regresnı analyzy

V souboru 25 jedincu jsme merili jejich vysku a hmotnost. Vysledky jsou v tabulce a grafu.

resp. c. 1 2 3 4 5 6 7 8 9 10 . . .vyska [cm] 164 178 187 182 161 183 190 160 193 183 . . .hmotnost [kg] 60 79 91 77 57 86 87 56 103 80 . . .

Statistika (KMI/PSTAT) 4 / 18

Page 7: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Uvod do regresnı analyzy

V souboru 25 jedincu jsme merili jejich vysku a hmotnost. Vysledky jsou v tabulce a grafu.

resp. c. 1 2 3 4 5 6 7 8 9 10 . . .vyska [cm] 164 178 187 182 161 183 190 160 193 183 . . .hmotnost [kg] 60 79 91 77 57 86 87 56 103 80 . . .

Statistika (KMI/PSTAT) 5 / 18

Page 8: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Uvod do regresnı analyzy

V souboru 25 jedincu jsme merili jejich vysku a hmotnost. Vysledky jsou v tabulce a grafu.

resp. c. 1 2 3 4 5 6 7 8 9 10 . . .vyska [cm] 164 178 187 182 161 183 190 160 193 183 . . .hmotnost [kg] 60 79 91 77 57 86 87 56 103 80 . . .

Statistika (KMI/PSTAT) 6 / 18

Page 9: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Uvod do regresnı analyzy

Regresnı analyza - regreseMame spojite veliciny a snazıme se najıt matemeticky model zavislosti techto velicin, tj. najıtvzorec, ktery cıselne popisuje vztah techto velicin

⇒ m = 1, 25·h−145, 1

Statistika (KMI/PSTAT) 7 / 18

Page 10: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Uvod do regresnı analyzy

Regresnı analyza - regreseMame spojite veliciny a snazıme se najıt matemeticky model zavislosti techto velicin, tj. najıtvzorec, ktery cıselne popisuje vztah techto velicin

⇒ m = 1, 25·h−145, 1

Statistika (KMI/PSTAT) 7 / 18

Page 11: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Uvod do regresnı analyzy

Regresnı analyza - regreseMame spojite veliciny a snazıme se najıt matemeticky model zavislosti techto velicin, tj. najıtvzorec, ktery cıselne popisuje vztah techto velicin

⇒ m = 1, 25·h−145, 1

Statistika (KMI/PSTAT) 7 / 18

Page 12: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Uvod do regresnı analyzy

Korelacnı analyza - korelaceKorelace - merenı kvality matematickeho modelu popisujıcıho zavislost spojitych velicin, tj. popis

”tesnosti“ namerenych dat a pouziteho matematickeho modelu; vcetne stanovenı, zda mezi

velicinami existuje zavislost

silna zavislost → vysoky korelacnı koeficient

zadna (slaba) zavislost → nulovy (blızky nule) korelacnı koeficient

Statistika (KMI/PSTAT) 8 / 18

Page 13: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Uvod do regresnı analyzy

Korelacnı analyza - korelaceKorelace - merenı kvality matematickeho modelu popisujıcıho zavislost spojitych velicin, tj. popis

”tesnosti“ namerenych dat a pouziteho matematickeho modelu; vcetne stanovenı, zda mezi

velicinami existuje zavislost

silna zavislost → vysoky korelacnı koeficient

zadna (slaba) zavislost → nulovy (blızky nule) korelacnı koeficient

Statistika (KMI/PSTAT) 8 / 18

Page 14: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Uvod do regresnı analyzy

Korelacnı analyza - korelaceKorelace - merenı kvality matematickeho modelu popisujıcıho zavislost spojitych velicin, tj. popis

”tesnosti“ namerenych dat a pouziteho matematickeho modelu; vcetne stanovenı, zda mezi

velicinami existuje zavislost

silna zavislost → vysoky korelacnı koeficient

zadna (slaba) zavislost → nulovy (blızky nule) korelacnı koeficient

Statistika (KMI/PSTAT) 8 / 18

Page 15: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Uvod do regresnı analyzy

Linearnı regreseHledame rovnici prımky, tj. predpis funkcnı zavislosti ve tvaru linearnı funkce y = b0 + b1x, kde

b1 =x · y − x · yx2 −

(x)2 , b0 = y − b1x.

Linearnı regrese

Naleznete regresnı prımku pro body [1; 3], [2; 5], [3; 11], [4; 14], tj.x 1 2 3 4y 3 5 11 14

x =10

4= 2, 5

y =33

4= 8, 25

x · y =102

4= 25, 5

x2 =30

4= 7, 5

b1 =x · y − x · yx2 −

(x)2 =

25, 5− 2, 5 · 8, 257, 5−

(2, 25

)2 =4, 875

1, 25= 3, 9

b0 = y − b1x = 8, 25− 3, 9 · 2, 5 = −1, 5

y= −1, 5 + 3, 9x, resp. y = 3, 9x− 1, 5

Statistika (KMI/PSTAT) 9 / 18

Page 16: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Uvod do regresnı analyzy

Linearnı regreseHledame rovnici prımky, tj. predpis funkcnı zavislosti ve tvaru linearnı funkce y = b0 + b1x, kde

b1 =x · y − x · yx2 −

(x)2 , b0 = y − b1x.

Linearnı regrese

Naleznete regresnı prımku pro body [1; 3], [2; 5], [3; 11], [4; 14], tj.x 1 2 3 4y 3 5 11 14

x =10

4= 2, 5

y =33

4= 8, 25

x · y =102

4= 25, 5

x2 =30

4= 7, 5

b1 =x · y − x · yx2 −

(x)2 =

25, 5− 2, 5 · 8, 257, 5−

(2, 25

)2 =4, 875

1, 25= 3, 9

b0 = y − b1x = 8, 25− 3, 9 · 2, 5 = −1, 5

y= −1, 5 + 3, 9x, resp. y = 3, 9x− 1, 5

Statistika (KMI/PSTAT) 9 / 18

Page 17: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Uvod do regresnı analyzy

Linearnı regreseHledame rovnici prımky, tj. predpis funkcnı zavislosti ve tvaru linearnı funkce y = b0 + b1x, kde

b1 =x · y − x · yx2 −

(x)2 , b0 = y − b1x.

Linearnı regrese

Naleznete regresnı prımku pro body [1; 3], [2; 5], [3; 11], [4; 14], tj.x 1 2 3 4y 3 5 11 14

x =10

4= 2, 5

y =33

4= 8, 25

x · y =102

4= 25, 5

x2 =30

4= 7, 5

b1 =x · y − x · yx2 −

(x)2 =

25, 5− 2, 5 · 8, 257, 5−

(2, 25

)2 =4, 875

1, 25= 3, 9

b0 = y − b1x = 8, 25− 3, 9 · 2, 5 = −1, 5

y= −1, 5 + 3, 9x, resp. y = 3, 9x− 1, 5

Statistika (KMI/PSTAT) 9 / 18

Page 18: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Uvod do regresnı analyzy

Linearnı regreseHledame rovnici prımky, tj. predpis funkcnı zavislosti ve tvaru linearnı funkce y = b0 + b1x, kde

b1 =x · y − x · yx2 −

(x)2 , b0 = y − b1x.

Linearnı regrese

Naleznete regresnı prımku pro body [1; 3], [2; 5], [3; 11], [4; 14], tj.x 1 2 3 4y 3 5 11 14

x =10

4= 2, 5

y =33

4= 8, 25

x · y =102

4= 25, 5

x2 =30

4= 7, 5

b1 =x · y − x · yx2 −

(x)2 =

25, 5− 2, 5 · 8, 257, 5−

(2, 25

)2 =4, 875

1, 25= 3, 9

b0 = y − b1x = 8, 25− 3, 9 · 2, 5 = −1, 5

y= −1, 5 + 3, 9x, resp. y = 3, 9x− 1, 5

Statistika (KMI/PSTAT) 9 / 18

Page 19: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Uvod do regresnı analyzy

Rovnice regresnı funkce ve tvaru polynomuMejme namereno m datovych bodu [x1, y1], [x2, y2], [x3, y3], . . . [xm, ym]. Hledame predpisfunkcnı zavislosti ve tvaru polynomicke funkce stupne n, tj. y = b0 + b1x+ b2x2 + . . .+ bnxn,tj. y = X ·B, kde

X = (1, x, . . . , xn) a B =

b0b1...bn

.

Lze ukazat, ze B vypocteme ze vztahu

B =(FT · F

)−1· FT · −→y ,

kde

F =

1 x1 (x1)2 . . . (x1)n

1 x2 (x2)2 . . . (x2)n

1 x3 (x3)2 . . . (x3)n

......

......

1 xm (xm)2 . . . (xm)n

a −→y =

y1y2...ym

.

Statistika (KMI/PSTAT) 10 / 18

Page 20: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Uvod do regresnı analyzy

Rovnice regresnı funkce ve tvaru polynomuMejme namereno m datovych bodu [x1, y1], [x2, y2], [x3, y3], . . . [xm, ym]. Hledame predpisfunkcnı zavislosti ve tvaru polynomicke funkce stupne n, tj. y = b0 + b1x+ b2x2 + . . .+ bnxn,tj. y = X ·B, kde

X = (1, x, . . . , xn) a B =

b0b1...bn

.

Lze ukazat, ze B vypocteme ze vztahu

B =(FT · F

)−1· FT · −→y ,

kde

F =

1 x1 (x1)2 . . . (x1)n

1 x2 (x2)2 . . . (x2)n

1 x3 (x3)2 . . . (x3)n

......

......

1 xm (xm)2 . . . (xm)n

a −→y =

y1y2...ym

.

Statistika (KMI/PSTAT) 10 / 18

Page 21: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Uvod do regresnı analyzy

Linearnı regrese

Naleznete regresnı kvadratickou funkci y = b0 + b1x+ b2x2 pro body [1; 3], [2; 5], [3; 11], [4; 14],

tj.x 1 2 3 4y 3 5 11 14

, kde B =(FT · F

)−1 · FT · −→y .

F =

1 x1 (x1)2 . . . (x1)n

1 x2 (x2)2 . . . (x2)n

......

......

1 xm (xm)2 . . . (xm)n

=

1 x1 (x1)2

1 x2 (x2)2

1 x3 (x3)2

1 x4 (x4)2

=

1 1 11 2 41 3 91 4 16

B =

b0b1b2

=

1 1 1 1

1 2 3 41 4 9 16

·

1 1 11 2 41 3 91 4 16

−1

·

1 1 1 11 2 3 41 4 9 16

·

351114

B =

4 10 3010 30 10030 100 354

−1

·

33102346

=

−0, 252, 650, 25

⇒ y = 0, 25x2 + 2, 65x− 0, 25

Statistika (KMI/PSTAT) 11 / 18

Page 22: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Uvod do regresnı analyzy

Linearnı regrese

Naleznete regresnı kvadratickou funkci y = b0 + b1x+ b2x2 pro body [1; 3], [2; 5], [3; 11], [4; 14],

tj.x 1 2 3 4y 3 5 11 14

, kde B =(FT · F

)−1 · FT · −→y .

F =

1 x1 (x1)2 . . . (x1)n

1 x2 (x2)2 . . . (x2)n

......

......

1 xm (xm)2 . . . (xm)n

=

1 x1 (x1)2

1 x2 (x2)2

1 x3 (x3)2

1 x4 (x4)2

=

1 1 11 2 41 3 91 4 16

B =

b0b1b2

=

1 1 1 1

1 2 3 41 4 9 16

·

1 1 11 2 41 3 91 4 16

−1

·

1 1 1 11 2 3 41 4 9 16

·

351114

B =

4 10 3010 30 10030 100 354

−1

·

33102346

=

−0, 252, 650, 25

⇒ y = 0, 25x2 + 2, 65x− 0, 25

Statistika (KMI/PSTAT) 11 / 18

Page 23: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Uvod do regresnı analyzy

Linearnı regrese

Naleznete regresnı kvadratickou funkci y = b0 + b1x+ b2x2 pro body [1; 3], [2; 5], [3; 11], [4; 14],

tj.x 1 2 3 4y 3 5 11 14

, kde B =(FT · F

)−1 · FT · −→y .

F =

1 x1 (x1)2 . . . (x1)n

1 x2 (x2)2 . . . (x2)n

......

......

1 xm (xm)2 . . . (xm)n

=

1 x1 (x1)2

1 x2 (x2)2

1 x3 (x3)2

1 x4 (x4)2

=

1 1 11 2 41 3 91 4 16

B =

b0b1b2

=

1 1 1 1

1 2 3 41 4 9 16

·

1 1 11 2 41 3 91 4 16

−1

·

1 1 1 11 2 3 41 4 9 16

·

351114

B =

4 10 3010 30 10030 100 354

−1

·

33102346

=

−0, 252, 650, 25

⇒ y = 0, 25x2 + 2, 65x− 0, 25

Statistika (KMI/PSTAT) 11 / 18

Page 24: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Uvod do regresnı analyzy

Linearnı regrese

Naleznete regresnı kvadratickou funkci y = b0 + b1x+ b2x2 pro body [1; 3], [2; 5], [3; 11], [4; 14],

tj.x 1 2 3 4y 3 5 11 14

, kde B =(FT · F

)−1 · FT · −→y .

F =

1 x1 (x1)2 . . . (x1)n

1 x2 (x2)2 . . . (x2)n

......

......

1 xm (xm)2 . . . (xm)n

=

1 x1 (x1)2

1 x2 (x2)2

1 x3 (x3)2

1 x4 (x4)2

=

1 1 11 2 41 3 91 4 16

B =

b0b1b2

=

1 1 1 1

1 2 3 41 4 9 16

·

1 1 11 2 41 3 91 4 16

−1

·

1 1 1 11 2 3 41 4 9 16

·

351114

B =

4 10 3010 30 10030 100 354

−1

·

33102346

=

−0, 252, 650, 25

⇒ y = 0, 25x2 + 2, 65x− 0, 25

Statistika (KMI/PSTAT) 11 / 18

Page 25: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Korelacnı analyza

Index determinace

K merenı kvality nalezeneho regresnıho modelu pouzıvame index determinace I2 = 1−Qe

Qy, kde

Qe =∑i(yi − yi)2 . . . rezidualnı soucet ctvercu,

Qy =∑i(yi − y)2 . . . variabilita dat,

yi . . . teoreticka hodnota y vypoctena na zaklade regresnıho modelu,yi . . . namerena hodnota y.

Index determinaceVypoctete index determinace pro data z predchozı ulohy, tj. pro body [1; 3], [2; 5], [3; 11], [4; 14]a regresnı funkci y = 3, 9x− 1, 5.

x y y y − y (y − y)2 y − 8, 25 (y − 8, 25)2

1 3 2,4 0,6 0,36 −5, 25 27,56252 5 6,3 1,3 1,69 −3, 25 10,56253 11 10,2 0,8 0,64 2, 75 7,56254 14 14,1 0,1 0,01 5, 75 33,0625

soucet 33 2,7 78,75

I2 = 1−2, 7

78, 75=

78, 75− 2, 7

78, 75=

76, 05

78, 75

.= 0, 966

Statistika (KMI/PSTAT) 12 / 18

Page 26: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Korelacnı analyza

Index determinace

K merenı kvality nalezeneho regresnıho modelu pouzıvame index determinace I2 = 1−Qe

Qy, kde

Qe =∑i(yi − yi)2 . . . rezidualnı soucet ctvercu,

Qy =∑i(yi − y)2 . . . variabilita dat,

yi . . . teoreticka hodnota y vypoctena na zaklade regresnıho modelu,yi . . . namerena hodnota y.

Index determinaceVypoctete index determinace pro data z predchozı ulohy, tj. pro body [1; 3], [2; 5], [3; 11], [4; 14]a regresnı funkci y = 3, 9x− 1, 5.

x y y y − y (y − y)2 y − 8, 25 (y − 8, 25)2

1 3 2,4 0,6 0,36 −5, 25 27,56252 5 6,3 1,3 1,69 −3, 25 10,56253 11 10,2 0,8 0,64 2, 75 7,56254 14 14,1 0,1 0,01 5, 75 33,0625

soucet 33 2,7 78,75

I2 = 1−2, 7

78, 75=

78, 75− 2, 7

78, 75=

76, 05

78, 75

.= 0, 966

Statistika (KMI/PSTAT) 12 / 18

Page 27: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Korelacnı analyza

Index determinace

K merenı kvality nalezeneho regresnıho modelu pouzıvame index determinace I2 = 1−Qe

Qy, kde

Qe =∑i(yi − yi)2 . . . rezidualnı soucet ctvercu,

Qy =∑i(yi − y)2 . . . variabilita dat,

yi . . . teoreticka hodnota y vypoctena na zaklade regresnıho modelu,yi . . . namerena hodnota y.

Index determinaceVypoctete index determinace pro data z predchozı ulohy, tj. pro body [1; 3], [2; 5], [3; 11], [4; 14]a regresnı funkci y = 3, 9x− 1, 5.

x y y y − y (y − y)2 y − 8, 25 (y − 8, 25)2

1 3 2,4 0,6 0,36 −5, 25 27,56252 5 6,3 1,3 1,69 −3, 25 10,56253 11 10,2 0,8 0,64 2, 75 7,56254 14 14,1 0,1 0,01 5, 75 33,0625

soucet 33 2,7 78,75

I2 = 1−2, 7

78, 75=

78, 75− 2, 7

78, 75=

76, 05

78, 75

.= 0, 966

Statistika (KMI/PSTAT) 12 / 18

Page 28: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Korelacnı analyza

Index determinace

K merenı kvality nalezeneho regresnıho modelu pouzıvame index determinace I2 = 1−Qe

Qy, kde

Qe =∑i(yi − yi)2 . . . rezidualnı soucet ctvercu,

Qy =∑i(yi − y)2 . . . variabilita dat,

yi . . . teoreticka hodnota y vypoctena na zaklade regresnıho modelu,yi . . . namerena hodnota y.

Index determinaceVypoctete index determinace pro data z predchozı ulohy, tj. pro body [1; 3], [2; 5], [3; 11], [4; 14]a regresnı funkci y = 3, 9x− 1, 5.

x y y y − y (y − y)2 y − 8, 25 (y − 8, 25)2

1 3 2,4 0,6 0,36 −5, 25 27,56252 5 6,3 1,3 1,69 −3, 25 10,56253 11 10,2 0,8 0,64 2, 75 7,56254 14 14,1 0,1 0,01 5, 75 33,0625

soucet 33 2,7 78,75

I2 = 1−2, 7

78, 75=

78, 75− 2, 7

78, 75=

76, 05

78, 75

.= 0, 966

Statistika (KMI/PSTAT) 12 / 18

Page 29: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Korelacnı analyza

Korelacnı koeficientK merenı kvality nalezeneho linearnıho regresnıho modelu pouzıvame korelacnı koeficient

r = sgn(b1) ·√I2.

r = sgn(3, 9) ·√

0, 966 = 1 · 0, 983 = 0, 983

Korelacnı koeficient

Korelacnı koeficient lze vypocıtat take ze vztahu r =x · y − x · y√(

x2 − (x)2)·(y2 − (y)2

)x y x2 y2 x · y1 3 1 9 32 5 4 25 103 11 9 11 334 14 16 196 56

soucet 10 33 30 351 102

x = 10/4 = 2, 5

y = 33/4 = 8, 25

x2 = 30/4 = 7, 5

y2 = 351/4 = 87, 75

x · y = 102/4 = 25, 5

r =25, 5− 2, 5 · 8, 25√

(7, 5− (2, 5)2) · (87, 75− (8, 25)2)

.= 0, 983

Statistika (KMI/PSTAT) 13 / 18

Page 30: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Korelacnı analyza

Korelacnı koeficientK merenı kvality nalezeneho linearnıho regresnıho modelu pouzıvame korelacnı koeficient

r = sgn(b1) ·√I2.

r = sgn(3, 9) ·√

0, 966 = 1 · 0, 983 = 0, 983

Korelacnı koeficient

Korelacnı koeficient lze vypocıtat take ze vztahu r =x · y − x · y√(

x2 − (x)2)·(y2 − (y)2

)x y x2 y2 x · y1 3 1 9 32 5 4 25 103 11 9 11 334 14 16 196 56

soucet 10 33 30 351 102

x = 10/4 = 2, 5

y = 33/4 = 8, 25

x2 = 30/4 = 7, 5

y2 = 351/4 = 87, 75

x · y = 102/4 = 25, 5

r =25, 5− 2, 5 · 8, 25√

(7, 5− (2, 5)2) · (87, 75− (8, 25)2)

.= 0, 983

Statistika (KMI/PSTAT) 13 / 18

Page 31: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Korelacnı analyza

Korelacnı koeficientK merenı kvality nalezeneho linearnıho regresnıho modelu pouzıvame korelacnı koeficient

r = sgn(b1) ·√I2.

r = sgn(3, 9) ·√

0, 966 = 1 · 0, 983 = 0, 983

Korelacnı koeficient

Korelacnı koeficient lze vypocıtat take ze vztahu r =x · y − x · y√(

x2 − (x)2)·(y2 − (y)2

)

x y x2 y2 x · y1 3 1 9 32 5 4 25 103 11 9 11 334 14 16 196 56

soucet 10 33 30 351 102

x = 10/4 = 2, 5

y = 33/4 = 8, 25

x2 = 30/4 = 7, 5

y2 = 351/4 = 87, 75

x · y = 102/4 = 25, 5

r =25, 5− 2, 5 · 8, 25√

(7, 5− (2, 5)2) · (87, 75− (8, 25)2)

.= 0, 983

Statistika (KMI/PSTAT) 13 / 18

Page 32: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Korelacnı analyza

Korelacnı koeficientK merenı kvality nalezeneho linearnıho regresnıho modelu pouzıvame korelacnı koeficient

r = sgn(b1) ·√I2.

r = sgn(3, 9) ·√

0, 966 = 1 · 0, 983 = 0, 983

Korelacnı koeficient

Korelacnı koeficient lze vypocıtat take ze vztahu r =x · y − x · y√(

x2 − (x)2)·(y2 − (y)2

)x y x2 y2 x · y1 3 1 9 32 5 4 25 103 11 9 11 334 14 16 196 56

soucet 10 33 30 351 102

x = 10/4 = 2, 5

y = 33/4 = 8, 25

x2 = 30/4 = 7, 5

y2 = 351/4 = 87, 75

x · y = 102/4 = 25, 5

r =25, 5− 2, 5 · 8, 25√

(7, 5− (2, 5)2) · (87, 75− (8, 25)2)

.= 0, 983

Statistika (KMI/PSTAT) 13 / 18

Page 33: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Korelacnı analyza

Korelacnı koeficientK merenı kvality nalezeneho linearnıho regresnıho modelu pouzıvame korelacnı koeficient

r = sgn(b1) ·√I2.

r = sgn(3, 9) ·√

0, 966 = 1 · 0, 983 = 0, 983

Korelacnı koeficient

Korelacnı koeficient lze vypocıtat take ze vztahu r =x · y − x · y√(

x2 − (x)2)·(y2 − (y)2

)x y x2 y2 x · y1 3 1 9 32 5 4 25 103 11 9 11 334 14 16 196 56

soucet 10 33 30 351 102

x = 10/4 = 2, 5

y = 33/4 = 8, 25

x2 = 30/4 = 7, 5

y2 = 351/4 = 87, 75

x · y = 102/4 = 25, 5

r =25, 5− 2, 5 · 8, 25√

(7, 5− (2, 5)2) · (87, 75− (8, 25)2)

.= 0, 983

Statistika (KMI/PSTAT) 13 / 18

Page 34: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Korelacnı analyza

Rezidualnı rozptyl

K porovnavanı kvality ruznych modelu slouzı rezidualnı rozptyl S2e =

Qe

n− p, kde

Qe =∑i(yi − yi)2 . . . rezidualnı soucet ctvercu,

n . . . pocet merenı,p . . . pocet parametru modelu.

linearnı model: y = 3, 9x− 1, 5, I2 = 0, 966kvadraticky model: y = 0, 25x2 + 2, 65x− 0, 25, I2 = 0, 969

linearnı model: y = 3, 9x− 1, 5, S2e = 2,7

4−2= 1, 35

kvadraticky model: y = 0, 25x2 + 2, 65x− 0, 25, S2e = 2,45

4−3= 2, 45

Cım nizsı rezidualnı rozptyl, tım lepsı model: vybereme linearnı model.

Statistika (KMI/PSTAT) 14 / 18

Page 35: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Korelacnı analyza

Rezidualnı rozptyl

K porovnavanı kvality ruznych modelu slouzı rezidualnı rozptyl S2e =

Qe

n− p, kde

Qe =∑i(yi − yi)2 . . . rezidualnı soucet ctvercu,

n . . . pocet merenı,p . . . pocet parametru modelu.

linearnı model: y = 3, 9x− 1, 5, I2 = 0, 966kvadraticky model: y = 0, 25x2 + 2, 65x− 0, 25, I2 = 0, 969

linearnı model: y = 3, 9x− 1, 5, S2e = 2,7

4−2= 1, 35

kvadraticky model: y = 0, 25x2 + 2, 65x− 0, 25, S2e = 2,45

4−3= 2, 45

Cım nizsı rezidualnı rozptyl, tım lepsı model: vybereme linearnı model.

Statistika (KMI/PSTAT) 14 / 18

Page 36: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Korelacnı analyza

Rezidualnı rozptyl

K porovnavanı kvality ruznych modelu slouzı rezidualnı rozptyl S2e =

Qe

n− p, kde

Qe =∑i(yi − yi)2 . . . rezidualnı soucet ctvercu,

n . . . pocet merenı,p . . . pocet parametru modelu.

linearnı model: y = 3, 9x− 1, 5, I2 = 0, 966kvadraticky model: y = 0, 25x2 + 2, 65x− 0, 25, I2 = 0, 969

linearnı model: y = 3, 9x− 1, 5, S2e = 2,7

4−2= 1, 35

kvadraticky model: y = 0, 25x2 + 2, 65x− 0, 25, S2e = 2,45

4−3= 2, 45

Cım nizsı rezidualnı rozptyl, tım lepsı model: vybereme linearnı model.

Statistika (KMI/PSTAT) 14 / 18

Page 37: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Korelacnı analyza

Rezidualnı rozptyl

K porovnavanı kvality ruznych modelu slouzı rezidualnı rozptyl S2e =

Qe

n− p, kde

Qe =∑i(yi − yi)2 . . . rezidualnı soucet ctvercu,

n . . . pocet merenı,p . . . pocet parametru modelu.

linearnı model: y = 3, 9x− 1, 5, I2 = 0, 966kvadraticky model: y = 0, 25x2 + 2, 65x− 0, 25, I2 = 0, 969

linearnı model: y = 3, 9x− 1, 5, S2e = 2,7

4−2= 1, 35

kvadraticky model: y = 0, 25x2 + 2, 65x− 0, 25, S2e = 2,45

4−3= 2, 45

Cım nizsı rezidualnı rozptyl, tım lepsı model: vybereme linearnı model.

Statistika (KMI/PSTAT) 14 / 18

Page 38: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Testovanı vyznamnosti regresnıch koeficientu

Testovanı vyznamnosti regresnıch koeficientu

Zjist’ujeme, zda je vysvetlovana promenna opravdu ovlivnovana vysvetlujıcı promennou.H0 : β1 = β2 = . . . = βp−1 = 0H1 : non H0

T =(Qy−Qe)/(p−1)

Qe/(n−p)W = 〈F1−α(p− 1, n− p);∞)

p . . . pocet parametru modelun . . . pocet namerenych dvojic dat

Statistika (KMI/PSTAT) 15 / 18

Page 39: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Testovanı vyznamnosti regresnıch koeficientu

Testovanı vyznamnosti regresnıch koeficientuNa hladine vyznamnosti α = 0, 05 otestujte vyznamnost regresnıch koeficientu pro data zuvodnıho prıkladu.

Qe = 2, 7,Qy = 78, 75,p = 2, p− 1 = 1,n = 4

H0 : β1 = 0H1 : β1 6= 0

T =(Qy−Qe)/(p−1)

Qe/(n−p)

W = 〈F1−α(p− 1, n− p);∞)

T =(78, 75− 2, 7)/1

2, 7/2

=76, 05

1, 35

.= 56, 3

W = 〈F1−α(p− 1, n− p);∞)

= 〈F0,95(1, 2);∞)

= 〈18, 513;∞)

T ∈W , zamıtame H0, hodnota y jeovlivnovana hodnotami promenne x.

Statistika (KMI/PSTAT) 16 / 18

Page 40: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Testovanı vyznamnosti regresnıch koeficientu

Testovanı vyznamnosti regresnıch koeficientuNa hladine vyznamnosti α = 0, 05 otestujte vyznamnost regresnıch koeficientu pro data zuvodnıho prıkladu.

Qe = 2, 7,Qy = 78, 75,p = 2, p− 1 = 1,n = 4

H0 : β1 = 0H1 : β1 6= 0

T =(Qy−Qe)/(p−1)

Qe/(n−p)

W = 〈F1−α(p− 1, n− p);∞)

T =(78, 75− 2, 7)/1

2, 7/2

=76, 05

1, 35

.= 56, 3

W = 〈F1−α(p− 1, n− p);∞)

= 〈F0,95(1, 2);∞)

= 〈18, 513;∞)

T ∈W , zamıtame H0, hodnota y jeovlivnovana hodnotami promenne x.

Statistika (KMI/PSTAT) 16 / 18

Page 41: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Testovanı vyznamnosti regresnıch koeficientu

Testovanı vyznamnosti regresnıch koeficientuNa hladine vyznamnosti α = 0, 05 otestujte vyznamnost regresnıch koeficientu pro data zuvodnıho prıkladu.

Qe = 2, 7,Qy = 78, 75,p = 2, p− 1 = 1,n = 4

H0 : β1 = 0H1 : β1 6= 0

T =(Qy−Qe)/(p−1)

Qe/(n−p)

W = 〈F1−α(p− 1, n− p);∞)

T =(78, 75− 2, 7)/1

2, 7/2

=76, 05

1, 35

.= 56, 3

W = 〈F1−α(p− 1, n− p);∞)

= 〈F0,95(1, 2);∞)

= 〈18, 513;∞)

T ∈W , zamıtame H0, hodnota y jeovlivnovana hodnotami promenne x.

Statistika (KMI/PSTAT) 16 / 18

Page 42: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Korelacnı a regresnı analyza

Prıklad IVe firme sledovali, jak dlouho je jiz dany pracovnık zamestnan a kolik procent zmetku za smenuvyrobı. Zjistili nasledujıcı data:

pocet mesıcu 45 47 51 58 64procenta zmetku 20 18 14 16 13

Vypoctete predpis regresnı prımky.

Interpretujte hodnoty koeficientu b0, b1.

Kolik procent zmetku muzeme ocekavat u zamestnance zamestnaneho 55 mesıcu.

Vypoctete a interpretujte hodnoty I2, r.

Vypoctete kvadraticky regresnı model a rozhodnete, zda je vhodnejsı linearnı cikvadraticky model k popisu techto dat.

Otestujte vyznamnost regresnıho koeficientu β1 v linearnı regresnı funkci.

Statistika (KMI/PSTAT) 17 / 18

Page 43: Statistika (KMI/PSTAT) - Cvicení dvanácté aneb Regrese a korelacefse.ujep.cz/~moc/studmat/pdf/pstat/2017_11.pdf · 2017. 5. 11. · Statistika (KMI/PSTAT) Cvi cen dvan act e aneb

Korelacnı a regresnı analyza

Prıklad IIObchodnı oddelenı se snazı odhadnout rovnici poptavky po svem produktu. Zjist’ovali mnozstvıQ poptavaneho zbozı (v tisıcıch ks) pri cene P . Zjistili nasledujıcı data:P 40 45 50 55 60Q 4,2 3,5 2,7 1,5 0,7

Vypoctete predpis rovnice poptavky ve tvaru linearnı funkce.

Interpretujte hodnoty koeficientu b0, b1.

Jake mnozstvı poptavaneho zbozı muzeme ocekavat pri cene 53 Kc?

Vypoctete a interpretujte hodnoty I2, r.

Vypoctete kvadraticky regresnı model a rozhodnete, zda je vhodnejsı linearnı cikvadraticky model k popisu techto dat.

Otestujte vyznamnost regresnıho koeficientu β1 v linearnı regresnı funkci.

Statistika (KMI/PSTAT) 18 / 18