Logistic Regression STA2101/442 F 2017

Slides:



Advertisements
Similar presentations
Dummy Dependent variable Models
Advertisements

STA305 Spring 2014 This started with excerpts from STA2101f13
Logistic Regression Psy 524 Ainsworth.
Logistic Regression I Outline Introduction to maximum likelihood estimation (MLE) Introduction to Generalized Linear Models The simplest logistic regression.
Introduction to Regression with Measurement Error STA431: Spring 2015.
Logistic Regression.
Regression Part II One-factor ANOVA Another dummy variable coding scheme Contrasts Multiple comparisons Interactions.
Logistic Regression STA302 F 2014 See last slide for copyright information 1.
April 25 Exam April 27 (bring calculator with exp) Cox-Regression
Logistic Regression Multivariate Analysis. What is a log and an exponent? Log is the power to which a base of 10 must be raised to produce a given number.
Binary Response Lecture 22 Lecture 22.
Introduction to Logistic Regression. Simple linear regression Table 1 Age and systolic blood pressure (SBP) among 33 adult women.
Data mining and statistical learning, lecture 5 Outline  Summary of regressions on correlated inputs  Ridge regression  PCR (principal components regression)
FIN357 Li1 Binary Dependent Variables Chapter 12 P(y = 1|x) = G(  0 + x  )
An Introduction to Logistic Regression
Introduction to Regression with Measurement Error STA431: Spring 2013.
Logistic regression for binary response variables.
1 G Lect 11W Logistic Regression Review Maximum Likelihood Estimates Probit Regression and Example Model Fit G Multiple Regression Week 11.
Double Measurement Regression STA431: Spring 2013.
1 BINARY CHOICE MODELS: PROBIT ANALYSIS In the case of probit analysis, the sigmoid function is the cumulative standardized normal distribution.
Maximum Likelihood See Davison Ch. 4 for background and a more thorough discussion. Sometimes.
Introduction to Regression with Measurement Error STA302: Fall/Winter 2013.
Excepted from HSRP 734: Advanced Statistical Methods June 5, 2008.
Factorial ANOVA More than one categorical explanatory variable STA305 Spring 2014.
Logistic Regression STA2101/442 F 2014 See last slide for copyright information.
LOGISTIC REGRESSION A statistical procedure to relate the probability of an event to explanatory variables Used in epidemiology to describe and evaluate.
Linear vs. Logistic Regression Log has a slightly better ability to represent the data Dichotomous Prefer Don’t Prefer Linear vs. Logistic Regression.
April 4 Logistic Regression –Lee Chapter 9 –Cody and Smith 9:F.
Regression Part II One-factor ANOVA Another dummy variable coding scheme Contrasts Multiple comparisons Interactions.
Week 5: Logistic regression analysis Overview Questions from last week What is logistic regression analysis? The mathematical model Interpreting the β.
1 Standard error Estimated standard error,s,. 2 Example 1 While measuring the thermal conductivity of Armco iron, using a temperature of 100F and a power.
Categorical Independent Variables STA302 Fall 2013.
Logistic Regression. Linear Regression Purchases vs. Income.
STA302: Regression Analysis. Statistics Objective: To draw reasonable conclusions from noisy numerical data Entry point: Study relationships between variables.
Qualitative and Limited Dependent Variable Models ECON 6002 Econometrics Memorial University of Newfoundland Adapted from Vera Tabakova’s notes.
Logistic Regression Saed Sayad 1www.ismartsoft.com.
CSE 5331/7331 F'07© Prentice Hall1 CSE 5331/7331 Fall 2007 Regression Margaret H. Dunham Department of Computer Science and Engineering Southern Methodist.
Categorical Independent Variables STA302 Fall 2015.
STA302: Regression Analysis. Statistics Objective: To draw reasonable conclusions from noisy numerical data Entry point: Study relationships between variables.
Logistic Regression Hal Whitehead BIOL4062/5062.
Logistic Regression An Introduction. Uses Designed for survival analysis- binary response For predicting a chance, probability, proportion or percentage.
Roger B. Hammer Assistant Professor Department of Sociology Oregon State University Conducting Social Research Logistic Regression Categorical Data Analysis.
Nonparametric Statistics
The Sample Variation Method A way to select sample size This slide show is a free open source document. See the last slide for copyright information.
Logistic Regression For a binary response variable: 1=Yes, 0=No This slide show is a free open source document. See the last slide for copyright information.
Data Modeling Patrice Koehl Department of Biological Sciences
Nonparametric Statistics
Chapter 7. Classification and Prediction
April 18 Intro to survival analysis Le 11.1 – 11.2
CHAPTER 7 Linear Correlation & Regression Methods
Exploratory Factor Analysis
Survival curves We know how to compute survival curves if everyone reaches the endpoint so there is no “censored” data. Survival at t = S(t) = number still.
Chapter 13 Nonlinear and Multiple Regression
THE LOGIT AND PROBIT MODELS
Poisson Regression STA 2101/442 Fall 2017
Interactions and Factorial ANOVA
Logistic Regression Part One
See Davison Ch. 4 for background and a more thorough discussion.
STA302: Regression Analysis
Multinomial Logit Models
Generalized Linear Models
THE LOGIT AND PROBIT MODELS
Nonparametric Statistics
Scatter Plots of Data with Various Correlation Coefficients
Statistical Assumptions for SLR
Mathematical Foundations of BME Reza Shadmehr
Logistic Regression.
Exploratory Factor Analysis. Factor Analysis: The Measurement Model D1D1 D8D8 D7D7 D6D6 D5D5 D4D4 D3D3 D2D2 F1F1 F2F2.
Logistic Regression.
Presentation transcript:

Logistic Regression STA2101/442 F 2017 See last slide for copyright information

Binary outcomes are common and important The patient survives the operation, or does not. The accused is convicted, or is not. The customer makes a purchase, or does not. The marriage lasts at least five years, or does not. The student graduates, or does not.

Response variable is binary (Bernoulli): 1=Yes, 0=No Logistic Regression Response variable is binary (Bernoulli): 1=Yes, 0=No Data analysis text has a lot of this stuff Pr\{Y=1|\mathbf{X}=\mathbf{x}\} = E(Y|\mathbf{X}=\mathbf{x}) = \pi % 36

Least Squares vs. Logistic Regression

The logistic regression curve arises from an indirect representation of the probability of Y=1 for a given set of x values. Representing the probability of an event by A number between 0 and 1, not 3.14159…

If P(Y=1)=1/2, odds = .5/(1-.5) = 1 (to 1) Always “to 1”

The higher the probability, the greater the odds

Linear regression model for the log odds of the event Y=1 for i = 1, …, n Beta0 is the intercept. $\beta_k$ is the increase in log odds of $Y=1$ when $x_k$ is increased by one unit, and all other explanatory variables are held constant. \begin{equation*} \log\left(\frac{\pi}{1-\pi} \right) = \beta_0 + \beta_1 x_1 + \ldots + \beta_{p-1} x_{p-1}. \end{equation*} % 32 Note $\pi$ is a \emph{conditional} probability. % 32

Equivalent Statements Odds RATIOS will yield nice cancellation \begin{equation*} \log\left(\frac{\pi}{1-\pi} \right) = \beta_0 + \beta_1 x_1 + \ldots + \beta_{p-1} x_{p-1}. \end{equation*} % 32 \begin{eqnarray*} \frac{\pi}{1-\pi} & = & e^{\beta_0 + \beta_1 x_1 + \ldots + \beta_{p-1} x_{p-1}} \\ & = & e^{\beta_0} e^{\beta_1 x_1} \cdots e^{\beta_{p-1} x_{p-1}}, \nonumber \end{eqnarray*} % 32 \begin{displaymath} \pi = \frac{e^{\beta_0 + \beta_1 x_1 + \ldots + \beta_{p-1} x_{p-1}}} {1+e^{\beta_0 + \beta_1 x_1 + \ldots + \beta_{p-1} x_{p-1}}} \end{displaymath} % 32

A distinctly non-linear function Non-linear in the betas So logistic regression is an example of non-linear regression. \begin{displaymath} E(Y|\mathbf{x}) = \pi = \frac{e^{\beta_0 + \beta_1 x_1 + \ldots + \beta_{p-1} x_{p-1}}} {1+e^{\beta_0 + \beta_1 x_1 + \ldots + \beta_{p-1} x_{p-1}}} \end{displaymath} % 32

Could use any cumulative distribution function: CDF of the standard normal used to be popular Called probit analysis Can be closely approximated with a logistic regression. $F(x) = \frac{e^x}{1+e^x}$ is called the \emph{logistic distribution}. \pi = F(\beta_0 + \beta_1 x_1 + \ldots + \beta_{p-1} x_{p-1}}) % 32

In terms of log odds, logistic regression is like regular regression Beta0 is intercept, beta_k is … \begin{equation*} \log\left(\frac{\pi}{1-\pi} \right) = \beta_0 + \beta_1 x_1 + \ldots + \beta_{p-1} x_{p-1}. \end{equation*} % 32

In terms of plain odds, (Exponential function of) the logistic regression coefficients are odds ratios For example, “Among 50 year old men, the odds of being dead before age 60 are three times as great for smokers.” Remember, alpha is an odds ratio

Logistic regression X=1 means smoker, X=0 means non-smoker Y=1 means dead, Y=0 means alive Log odds of death = Odds of death =

Cancer Therapy Example X = disease severity x is severity of disease

For any given disease severity x, What if beta1 > 0 ? Chemo alone is better. Reasonable?

In general, When xk is increased by one unit and all other explanatory variables are held constant, the odds of Y=1 are multiplied by That is, is an odds ratio --- the ratio of the odds of Y=1 when xk is increased by one unit, to the odds of Y=1 when everything is left alone. As in ordinary regression, we speak of “controlling” for the other variables.

The conditional probability of Y=1 This formula can be used to calculate a predicted P(Y=1|x). Just replace betas by their estimates \begin{eqnarray*} \pi_i &=& \frac{e^{\beta_0 + \beta_1 x_{i,1} + \ldots + \beta_{p-1} x_{i,p-1}}} {1+e^{\beta_0 + \beta_1 x_{i,1} + \ldots + \beta_{p-1} x_{i,p-1}}} \\ &&\\ &=& \frac{e^{\mathbf{x}_i^\top \boldsymbol{\beta}}} {1+e^{\mathbf{x}_i^\top \boldsymbol{\beta}}} \end{eqnarray*} % 32 It can also be used to calculate the probability of getting the sample data values we actually did observe, as a function of the betas.

Likelihood Function \begin{eqnarray*} L(\boldsymbol{\beta}) &=& \prod_{i=1}^n P(Y_i=y_i|\mathbf{x}_i) = \prod_{i=1}^n \pi_i^{y_i} (1-\pi_i)^{1-y_i} \\ &=& \prod_{i=1}^n \left( \frac{e^{\mathbf{x}_i^\top \boldsymbol{\beta}}} {1+e^{\mathbf{x}_i^\top \boldsymbol{\beta}}} \right)^{y_i} \left(1 - \frac{e^{\mathbf{x}_i^\top \boldsymbol{\beta}}} \right)^{1-y_i} \\ \left( \frac{1} &=& \prod_{i=1}^n \frac{e^{y_i\mathbf{x}_i^\top \boldsymbol{\beta}}} {1+e^{\mathbf{x}_i^\top \boldsymbol{\beta}}} \\ &=& \frac{e^{\sum_{i=1}^n y_i\mathbf{x}_i^\top \boldsymbol{\beta}}} {\prod_{i=1}^n \left( 1+e^{\mathbf{x}_i^\top \boldsymbol{\beta}} \right)} \end{eqnarray*} % 24

Maximum likelihood estimation Likelihood = Conditional probability of getting the data values we did observe, As a function of the betas Maximize the (log) likelihood with respect to betas. Maximize numerically (“Iteratively re-weighted least squares”) Likelihood ratio, Wald tests as usual Divide regression coefficients by estimated standard errors to get Z-tests of H0: bj=0. These Z-tests are like the t-tests in ordinary regression. No details about the numerical method

Copyright Information This slide show was prepared by Jerry Brunner, Department of Statistics, University of Toronto. It is licensed under a Creative Commons Attribution - ShareAlike 3.0 Unported License. Use any part of it as you like and share the result freely. These Powerpoint slides are available from the course website: http://www.utstat.toronto.edu/brunner/oldclass/appliedf17