It looks like you're using Internet Explorer 11 or older. This website works best with modern browsers such as the latest versions of Chrome, Firefox, Safari, and Edge. If you continue with this browser, you may see unexpected results.

# Logistic Regression Workshop: Home

## ATTENTION

ATTENTION: With the departure of Dr. Raeda Anderson from GSU July 2020, the workshop materials and information on this guide will no longer be actively supported.  These materials will be kept online for the time being.  For questions about these materials, or to inquire about currently supported workshops and subject-areas, please visit the Research Data Services homepage: https://research.library.gsu.edu/dataservices

## Dr. Raeda Anderson

This guide's content was authored by Dr. Raeda Anderson. Written permission must be gained from the author for any reuse, remix, or distribution of the guide content and associated materials.

Dr. Anderson's email: raedaanderson@gmail.com

## Code for Logistic Regression Workshop

*******************************
*******************************
***** LOGISTIC REGRESSION *****
*******************************
*******************************

* To run code you hilight the code you wish to run and hit Control+d

* NOTE: This do file should not be distributed without the written
* permission of Raeda Anderson, Ph.D

*************************
*************************
****** DATA SET UP ******
*************************
*************************

* pull in data
use http://www.stata-press.com/data/r15/lbw.dta

* look at study variables
codebook low smoke age race ht ui ftv

* generate black variable
gen black = .
replace black =1 if race == 2
replace black =0 if race == 1
replace black =0 if race == 3

*generate white variable
gen white = .
replace white =1 if race == 1
replace white =0 if race == 2
replace white =0 if race == 3
*******************************
*******************************
***** LOGISTIC REGRESSION *****
*******************************
*******************************

***** Predicting Low Birth Weight *****
*******************
*** ODDS RATIOS ***
*******************
* Model 1
logistic low smoke

* Model 2
logistic low smoke ht
* Model 3
logistic low smoke ht black
* Model 4
logistic low smoke ht black white
********************************
*** CORRELATION COEFFICIENTS ***
********************************
* Model 1
logistic low smoke, coef

* Model 2
logistic low smoke age, coef
* Model 3
logistic low smoke age black, coef
* Model 4
logistic low smoke age black white, coef

***** Predicting Smoking During Pregnancy *****
*******************
*** ODDS RATIOS ***
*******************
* Model 1
logistic smoke ht

* Model 2
logistic smoke ht age
* Model 3
logistic smoke ht age ptl

Jeremy Walker
Contact:
GSU - Atlanta
Library South
Suite 542
(by appointment)
Website