Regresi Logistik Ordinal - kusmansadik.files.wordpress.com · 14-01-2018 · 6 The slopes are...

28
Dr. Kusman Sadik, M.Si Program Studi Magister (S2) Departemen Statistika IPB, 2017/2018 Regresi Logistik Ordinal (Peubah Respon Multikategori : Ordinal)

Transcript of Regresi Logistik Ordinal - kusmansadik.files.wordpress.com · 14-01-2018 · 6 The slopes are...

Page 1: Regresi Logistik Ordinal - kusmansadik.files.wordpress.com · 14-01-2018 · 6 The slopes are assumed to be the same for all logits and, under this assumption, the model is known

Dr. Kusman Sadik, M.Si

Program Studi Magister (S2)

Departemen Statistika IPB, 2017/2018

Regresi Logistik Ordinal

(Peubah Respon Multikategori : Ordinal)

Page 2: Regresi Logistik Ordinal - kusmansadik.files.wordpress.com · 14-01-2018 · 6 The slopes are assumed to be the same for all logits and, under this assumption, the model is known

2

The main feature of the ordinal logistic models is that

they predict the log odds, odds, or probability of a

response occurring at or below any given outcome

category.

For example, ordering the educational attainment

categories from lowest to highest (less than high

school, high school, junior college, bachelor’s degree,

graduate degree) we can use this model to predict the

probability of being (for example) at the bachelor’s

level or below from age at first marriage.

Page 3: Regresi Logistik Ordinal - kusmansadik.files.wordpress.com · 14-01-2018 · 6 The slopes are assumed to be the same for all logits and, under this assumption, the model is known

3

.... (a)

a

Page 4: Regresi Logistik Ordinal - kusmansadik.files.wordpress.com · 14-01-2018 · 6 The slopes are assumed to be the same for all logits and, under this assumption, the model is known

4

Page 5: Regresi Logistik Ordinal - kusmansadik.files.wordpress.com · 14-01-2018 · 6 The slopes are assumed to be the same for all logits and, under this assumption, the model is known

5

a

Page 6: Regresi Logistik Ordinal - kusmansadik.files.wordpress.com · 14-01-2018 · 6 The slopes are assumed to be the same for all logits and, under this assumption, the model is known

6

The slopes are assumed to be the same for all logits

and, under this assumption, the model is known as the

proportional odds model.

The underlying assumption of equivalent slopes across

all logits can, and should, be tested to verify that this

model is appropriate.

If this assumption appears to be violated, then one

could fit the nominal, or more complicated alternative

models.

Page 7: Regresi Logistik Ordinal - kusmansadik.files.wordpress.com · 14-01-2018 · 6 The slopes are assumed to be the same for all logits and, under this assumption, the model is known

7

We use data from the 2006 GSS to predict a

respondent’s educational attainment level (degree),

measured as either less than high school, high school,

junior college, bachelor’s degree, or graduate degree,

from the respondent’s age when first married

(agewed).

The outcome variable (educational attainment level) is

treated as ordinal, so the proportional odds model is

used.

Page 8: Regresi Logistik Ordinal - kusmansadik.files.wordpress.com · 14-01-2018 · 6 The slopes are assumed to be the same for all logits and, under this assumption, the model is known

8

# Model Logistik Ordinal untuk Data GSS (Azen, sub-bab 10.5)

# Data Respon : Harus Data Terurut

dataku <- read.csv(file=“Data-GSS-2006.csv", header=TRUE)

degree <- factor(dataku$degree)

degree.order <- factor(dataku$degree.order)

agewed <- dataku$agewed

data.frame(degree,degree.order,agewed)

# Package yang diperlukan #

library("foreign")

library("MASS")

library("nnet")

table(degree,degree.order)

model <- polr(degree.order ~ agewed, method="logistic")

summary(model)

Page 9: Regresi Logistik Ordinal - kusmansadik.files.wordpress.com · 14-01-2018 · 6 The slopes are assumed to be the same for all logits and, under this assumption, the model is known

9

degree degree.order agewed

1 HIGH SCHOOL 2 22

2 HIGH SCHOOL 2 23

3 HIGH SCHOOL 2 24

4 HIGH SCHOOL 2 22

5 LT HIGH SCHOOL 1 28

6 LT HIGH SCHOOL 1 21

7 HIGH SCHOOL 2 29

8 LT HIGH SCHOOL 1 19

9 LT HIGH SCHOOL 1 28

10 LT HIGH SCHOOL 1 29

.

.

.

1158 HIGH SCHOOL 2 21

1159 HIGH SCHOOL 2 22

1160 BACHELOR 4 28

Catatan : yang dipakai “degree.order” bukan

“degree”, karena “degree” belum terurut.

Page 10: Regresi Logistik Ordinal - kusmansadik.files.wordpress.com · 14-01-2018 · 6 The slopes are assumed to be the same for all logits and, under this assumption, the model is known

10

degree.order

degree 1 2 3 4 5

LT HIGH SCHOOL 195 0 0 0 0

BACHELOR 0 0 0 185 0

GRADUATE 0 0 0 0 104

HIGH SCHOOL 0 590 0 0 0

JUNIOR COLLEGE 0 0 86 0 0

Page 11: Regresi Logistik Ordinal - kusmansadik.files.wordpress.com · 14-01-2018 · 6 The slopes are assumed to be the same for all logits and, under this assumption, the model is known

11

Coefficients:

Value Std. Error t value

agewed 0.05059 0.01031 4.908

Intercepts:

Value Std. Error t value

1|2 -0.4549 0.2431 -1.8711

2|3 1.9226 0.2501 7.6886

3|4 2.2940 0.2530 9.0670

4|5 3.5242 0.2682 13.1389

Residual Deviance: 3096.156

AIC: 3106.156

Page 12: Regresi Logistik Ordinal - kusmansadik.files.wordpress.com · 14-01-2018 · 6 The slopes are assumed to be the same for all logits and, under this assumption, the model is known

12

Output SAS : Bandingkan dengan Output R

Page 13: Regresi Logistik Ordinal - kusmansadik.files.wordpress.com · 14-01-2018 · 6 The slopes are assumed to be the same for all logits and, under this assumption, the model is known

13

Output SAS : Bandingkan dengan Output R

Page 14: Regresi Logistik Ordinal - kusmansadik.files.wordpress.com · 14-01-2018 · 6 The slopes are assumed to be the same for all logits and, under this assumption, the model is known

14

Perbedaan Model antara R, SPSS, dan SAS

R dan SPSS

SAS

Page 15: Regresi Logistik Ordinal - kusmansadik.files.wordpress.com · 14-01-2018 · 6 The slopes are assumed to be the same for all logits and, under this assumption, the model is known

15

Perbedaan Model antara R, SPSS, dan SAS

Page 16: Regresi Logistik Ordinal - kusmansadik.files.wordpress.com · 14-01-2018 · 6 The slopes are assumed to be the same for all logits and, under this assumption, the model is known

16

Interpretasi dan Pengujin Parameter

Page 17: Regresi Logistik Ordinal - kusmansadik.files.wordpress.com · 14-01-2018 · 6 The slopes are assumed to be the same for all logits and, under this assumption, the model is known

17

Ilustrasi Interpretasi Parameter (Output R)

Coefficients:

Value Std. Error t value

agewed 0.05059 0.01031 4.908

Intercepts:

Value Std. Error t value

1|2 -0.4549 0.2431 -1.8711

2|3 1.9226 0.2501 7.6886

3|4 2.2940 0.2530 9.0670

4|5 3.5242 0.2682 13.1389

Page 18: Regresi Logistik Ordinal - kusmansadik.files.wordpress.com · 14-01-2018 · 6 The slopes are assumed to be the same for all logits and, under this assumption, the model is known

18

Ilustrasi Interpretasi Parameter (Output R)

Page 19: Regresi Logistik Ordinal - kusmansadik.files.wordpress.com · 14-01-2018 · 6 The slopes are assumed to be the same for all logits and, under this assumption, the model is known

19

Ilustrasi Interpretasi Parameter (Output R)

Page 20: Regresi Logistik Ordinal - kusmansadik.files.wordpress.com · 14-01-2018 · 6 The slopes are assumed to be the same for all logits and, under this assumption, the model is known

20

Page 21: Regresi Logistik Ordinal - kusmansadik.files.wordpress.com · 14-01-2018 · 6 The slopes are assumed to be the same for all logits and, under this assumption, the model is known

21

1. Gunakan Program R untuk data Mental Impairment (Agresti, sub-

bab 7.2.4, hlm. 279 ) .

a. Bandingkan hasilnya dengan output SAS pada buku Agresti

tersebut serta berikan interpretasi pada tiap nilai dugaan

parameter model.

b. Berdasarkan hasil pada poin (a) di atas, tentukan nilai dugaan

P(Y = 1), P(Y = 3), dan P(Y > 2).

c. Tentukan model terbaik.

Page 22: Regresi Logistik Ordinal - kusmansadik.files.wordpress.com · 14-01-2018 · 6 The slopes are assumed to be the same for all logits and, under this assumption, the model is known

22

Page 23: Regresi Logistik Ordinal - kusmansadik.files.wordpress.com · 14-01-2018 · 6 The slopes are assumed to be the same for all logits and, under this assumption, the model is known

23

Page 24: Regresi Logistik Ordinal - kusmansadik.files.wordpress.com · 14-01-2018 · 6 The slopes are assumed to be the same for all logits and, under this assumption, the model is known

24

Page 25: Regresi Logistik Ordinal - kusmansadik.files.wordpress.com · 14-01-2018 · 6 The slopes are assumed to be the same for all logits and, under this assumption, the model is known

25

Page 26: Regresi Logistik Ordinal - kusmansadik.files.wordpress.com · 14-01-2018 · 6 The slopes are assumed to be the same for all logits and, under this assumption, the model is known

26

Pustaka

1. Azen, R. dan Walker, C.R. (2011). Categorical Data

Analysis for the Behavioral and Social Sciences.

Routledge, Taylor and Francis Group, New York.

2. Agresti, A. (2002). Categorical Data Analysis 2nd. New

York: Wiley.

3. Pustaka lain yang relevan.

Page 27: Regresi Logistik Ordinal - kusmansadik.files.wordpress.com · 14-01-2018 · 6 The slopes are assumed to be the same for all logits and, under this assumption, the model is known

27

Bisa di-download di

kusmansadik.wordpress.com

Page 28: Regresi Logistik Ordinal - kusmansadik.files.wordpress.com · 14-01-2018 · 6 The slopes are assumed to be the same for all logits and, under this assumption, the model is known

28

Terima Kasih