Regresi Logistik II. (Peubah Bebas : Kategorik) Dr. Kusman Sadik, M.Si Program Studi Pascasarjana Departemen Statistika IPB, 2018/2019

Similar documents
Model Linear Terampat (Generalized Linear Model / GLM) Dr. Kusman Sadik, M.Si Departemen Statistika IPB, 2017/2018

Explanatory variables are: weight, width of shell, color (medium light, medium, medium dark, dark), and condition of spine.

Categorical Predictor Variables

Logistic Regression 21/05

Linear Regression Models P8111

Duration of Unemployment - Analysis of Deviance Table for Nested Models

Statistics 203 Introduction to Regression Models and ANOVA Practice Exam

STA102 Class Notes Chapter Logistic Regression

A Generalized Linear Model for Binomial Response Data. Copyright c 2017 Dan Nettleton (Iowa State University) Statistics / 46

Class Notes: Week 8. Probit versus Logit Link Functions and Count Data

Econometrics II. Seppo Pynnönen. Spring Department of Mathematics and Statistics, University of Vaasa, Finland

Regression Methods for Survey Data

ANALISIS BIVARIAT DATA NUMERIK DAN NUMERIK Uji Korelasi dan Regresi

Generalized linear models

Analysing categorical data using logit models

Review: what is a linear model. Y = β 0 + β 1 X 1 + β 2 X 2 + A model of the following form:

Interactions in Logistic Regression

Logistic Regressions. Stat 430

Logistic Regression. James H. Steiger. Department of Psychology and Human Development Vanderbilt University

Generalized linear models for binary data. A better graphical exploratory data analysis. The simple linear logistic regression model

Exam Applied Statistical Regression. Good Luck!

Generalised linear models. Response variable can take a number of different formats

Clinical Trials. Olli Saarela. September 18, Dalla Lana School of Public Health University of Toronto.

Linear Regression. Data Model. β, σ 2. Process Model. ,V β. ,s 2. s 1. Parameter Model

Regression models. Generalized linear models in R. Normal regression models are not always appropriate. Generalized linear models. Examples.

Introduction to the Generalized Linear Model: Logistic regression and Poisson regression

BMI 541/699 Lecture 22

22s:152 Applied Linear Regression

NATIONAL UNIVERSITY OF SINGAPORE EXAMINATION. ST3241 Categorical Data Analysis. (Semester II: ) April/May, 2011 Time Allowed : 2 Hours

cor(dataset$measurement1, dataset$measurement2, method= pearson ) cor.test(datavector1, datavector2, method= pearson )

Log-linear Models for Contingency Tables

Regression with Qualitative Information. Part VI. Regression with Qualitative Information

7/28/15. Review Homework. Overview. Lecture 6: Logistic Regression Analysis

Poisson Regression. The Training Data

Regression so far... Lecture 21 - Logistic Regression. Odds. Recap of what you should know how to do... At this point we have covered: Sta102 / BME102

Age 55 (x = 1) Age < 55 (x = 0)

Generalized Linear Models

Week 7 Multiple factors. Ch , Some miscellaneous parts

Model Estimation Example

Simple logistic regression

R Hints for Chapter 10

CHAPTER 4 & 5 Linear Regression with One Regressor. Kazu Matsuda IBEC PHBU 430 Econometrics

On the Inference of the Logistic Regression Model

Exercise 5.4 Solution

Stat 8053, Fall 2013: Multinomial Logistic Models

Investigating Models with Two or Three Categories

Matched Pair Data. Stat 557 Heike Hofmann

Tento projekt je spolufinancován Evropským sociálním fondem a Státním rozpočtem ČR InoBio CZ.1.07/2.2.00/

Truck prices - linear model? Truck prices - log transform of the response variable. Interpreting models with log transformation

Logistic & Tobit Regression

ST3241 Categorical Data Analysis I Logistic Regression. An Introduction and Some Examples

ST3241 Categorical Data Analysis I Multicategory Logit Models. Logit Models For Nominal Responses

Generalized Linear Models. stat 557 Heike Hofmann

12 Modelling Binomial Response Data

STAT 7030: Categorical Data Analysis

Data-analysis and Retrieval Ordinal Classification

KUESIONER PENELITIAN. No. Responden: Kepada Yth. Saudara/i di tempat. Dengan hormat,

Lecture 14: Introduction to Poisson Regression

Modelling counts. Lecture 14: Introduction to Poisson Regression. Overview

Today. HW 1: due February 4, pm. Aspects of Design CD Chapter 2. Continue with Chapter 2 of ELM. In the News:

NATIONAL UNIVERSITY OF SINGAPORE EXAMINATION (SOLUTIONS) ST3241 Categorical Data Analysis. (Semester II: )

ST430 Exam 2 Solutions

Logistic Regression - problem 6.14

Comparing Nested Models

(c) Interpret the estimated effect of temperature on the odds of thermal distress.

Introducing Generalized Linear Models: Logistic Regression

Appendix 1. The result of normality with Kolmogorov-Smirnov method and descriptive

Classification. Chapter Introduction. 6.2 The Bayes classifier

Ron Heck, Fall Week 8: Introducing Generalized Linear Models: Logistic Regression 1 (Replaces prior revision dated October 20, 2011)

lme4 Luke Chang Last Revised July 16, Fitting Linear Mixed Models with a Varying Intercept

Hierarchical Generalized Linear Models. ERSH 8990 REMS Seminar on HLM Last Lecture!

Logistic Regression for Circular Data

STAC51: Categorical data Analysis

STA 303 H1S / 1002 HS Winter 2011 Test March 7, ab 1cde 2abcde 2fghij 3

STA 4504/5503 Sample Exam 1 Spring 2011 Categorical Data Analysis. 1. Indicate whether each of the following is true (T) or false (F).


Goodness-of-Fit Tests for the Ordinal Response Models with Misspecified Links

STA 4504/5503 Sample Exam 1 Spring 2011 Categorical Data Analysis. 1. Indicate whether each of the following is true (T) or false (F).

Lecture 12: Effect modification, and confounding in logistic regression

1. Logistic Regression, One Predictor 2. Inference: Estimating the Parameters 3. Multiple Logistic Regression 4. AIC and BIC in Logistic Regression

MAT 202 Introduction to Analysis [ Pengantar Analisis]

SCHOOL OF MATHEMATICS AND STATISTICS. Linear and Generalised Linear Models

ssh tap sas913, sas

Logistic Regression. Continued Psy 524 Ainsworth

MAT 101 Calculus [ Kalkulus]

STATS216v Introduction to Statistical Learning Stanford University, Summer Midterm Exam (Solutions) Duration: 1 hours

Introduction To Logistic Regression

EME 411 Numerical Methods For Engineers [Kaedah Berangka Untuk Jurutera]

Sample solutions. Stat 8051 Homework 8

Explanatory Variables Must be Linear Independent...

Model Based Statistics in Biology. Part V. The Generalized Linear Model. Chapter 18.1 Logistic Regression (Dose - Response)

Generalized Linear Models

EXAMINATION FOR THE DEGREE OF BACHELOR OF SCIENCE WITH EDUCATION PEPERIKSAAN IJAZAH SARJANA MUDA SAINS DENGAN PENDIDIKAN

22s:152 Applied Linear Regression. Take random samples from each of m populations.

9 Generalized Linear Models

Chapter 14 Logistic regression

22s:152 Applied Linear Regression. There are a couple commonly used models for a one-way ANOVA with m groups. Chapter 8: ANOVA

R Output for Linear Models using functions lm(), gls() & glm()

Ch 6: Multicategory Logit Models

Random Independent Variables

Transcription:

Regresi Logistik II (Peubah Bebas : Kategorik) Dr. Kusman Sadik, M.Si Program Studi Pascasarjana Departemen Statistika IPB, 2018/2019

In the case of logistic regression, the response variable is a binary or dichotomous variable, which means it can only take on one of two possible values. Case: logistic regression models in which the predictors are categorical or qualitative variables (such as gender, location, and socioeconomic status). All of the material on logistic regression modeling remains the same, but the coding of the predictors (dummy coding) and interpretation of the regression coefficients changes due to the categorical nature of the predictors. 2

The interpretation of the model parameters (intercept, slope) discussed for continuous predictor variables does not change fundamentally for categorical predictor variables. The main difference between quantitative or continuous predictors and qualitative or categorical predictors is that the latter need to be coded such that (C 1) indicator variables are required to represent a total of C categories. 3

When dummy coding is used, the last category of the variable is used as a reference category. Therefore, the parameter associated with the last category is set to zero, and each of the remaining parameters of the model is interpreted relative to the last category. 4

5

6

7

8

9

10

11

12

Inferensia 13

Catatan : Uji G 2 sama dengan Uji Deviance 14

15

Pengaruh Interaksi 16

17

Gender SES Interaksi 18

19

20

21

* Model Logistik untuk Data Horseshoe Crab (Agresti, 5.4.4) * dataku <- read.csv(file="data-horseshoe.crab-agresti.csv") c <- factor(dataku[,1]) s <- factor(dataku[,2]) w <- dataku[,3] wt <- dataku[,4] sa <- dataku[,5] y <- c(1:173) for (i in 1:length(sa)) { if (sa[i] > 0) (y[i] = 1) else (y[i] = 0) } color <- relevel(c, ref="4") width <- w data.frame(color,s,width,wt,sa,y) model <- glm(y ~ color+width, family=binomial("link"=logit)) summary(model) dugaan <- round(fitted(model),2) data.frame(color,width,y,dugaan) 22

Call: glm(formula = y ~ color+width, family = binomial(link = logit)) Coefficients: Estimate Std. Error z value Pr(> z ) Intercept -12.7151 2.7617-4.604 4.14e-06 *** color1 1.3299 0.8525 1.560 0.1188 color2 1.4023 0.5484 2.557 0.0106 * color3 1.1061 0.5921 1.868 0.0617. width 0.4680 0.1055 4.434 9.26e-06 *** Signif. codes: 0 *** 0.001 ** 0.01 * 0.05. Null deviance: 225.76 on 172 degrees of freedom Residual deviance: 187.46 on 168 degrees of freedom AIC: 197.46 23

color width y dugaan 1 2 28.3 1 0.87 2 3 26.0 1 0.64 3 3 25.6 0 0.59 4 4 21.0 0 0.05 5 2 29.0 1 0.91 6 1 25.0 1 0.58 7 4 26.2 0 0.39 8 2 24.9 0 0.58... 171 2 26.5 1 0.75 172 3 26.1 1 0.65 173 2 24.5 0 0.54 24

25

26

H 0 : β 1 = β 2 = β 3 = 0 Call: H 0 glm(formula = y ~ width, family = binomial(link = logit)) Null deviance : 225.76 on 172 degrees of freedom Residual deviance: 194.45 on 171 degrees of freedom AIC: 198.45 Call: H 1 glm(formula = y ~ color + width, family = binomial(link = logit)) Null deviance : 225.76 on 172 degrees of freedom Residual deviance: 187.46 on 168 degrees of freedom AIC: 197.46 Apa kesimpulan dari uji deviance tersebut? 27

28

1. Gunakan Program R untuk data Horseshoe Crabs Revisited (Agresti, sub-bab 5.4.4 ). a. Lakukan pemodelan regresi logistik dengan peubah bebasnya adalah Width (x) dan Color (c). Bandingkan hasil output R dengan output SAS di dalam buku Agresti. Jelaskan interpretasinya. b. Lakukan pemodelan regresi logistik dengan peubah bebasnya adalah Width (x), Color (c), dan Spine (s), tanpa interaksi. Apakah Spine berpengaruh nyata? Gunakan uji Deviance untuk = 0.05. c. Pada model bagian (b) di atas, lalukan uji Deviance pada = 0.05 untuk mengetahui apakah ada interaksi antara Color dan Spine. Jelaskan interpretasinya. 29

2. Gunakan Program R untuk menyelesaikan Problems 9.5 (Azen, hlm. 241 ). 30

31

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 2 nd. New York: Wiley. 3. Pustaka lain yang relevan. 32

Bisa di-download di kusmansadik.wordpress.com 33

Terima Kasih 34