Stata Workshop 3 Logistic Regression ChiuHsieh Paul Hsu

  • Slides: 6
Download presentation
Stata Workshop #3 Logistic Regression Chiu-Hsieh (Paul) Hsu Associate Professor College of Public Health

Stata Workshop #3 Logistic Regression Chiu-Hsieh (Paul) Hsu Associate Professor College of Public Health pchhsu@email. arizona. edu

Logistic Regression • • – • • • Binary outcome For example, ICU hospital

Logistic Regression • • – • • • Binary outcome For example, ICU hospital acquired infection Expression Log[p/(1 -p)]=β 0 + β 1 x 1 + β 2 x 2 Linear relationship between log odds and x Often use odds ratio, i. e. exp(β), to interpret the results • http: //www. ats. ucla. edu/stata/sem inars/stata_logistic/default. htm

Data Set • ICU HAI in southern France • Identify factors associated with ICU

Data Set • ICU HAI in southern France • Identify factors associated with ICU HAI • Endpoint – # of ICU HAI • Independent variables: gender, age, season, year and antibiotics at admission

Data Management • Generate binary ICU HAI status – Stata command • gen haistatus=nhai

Data Management • Generate binary ICU HAI status – Stata command • gen haistatus=nhai • replace haistatus=1 if nhai>0 • Generate dummy variables for season – Stata command: xi i. season – Three dummy variables: _Iseason_2, _Iseason_3 and _Iseason_4, i. e. season 1 (spring) as the reference group

Data Summary • HAI by gender – Stata command: tab gender haistatus if gender

Data Summary • HAI by gender – Stata command: tab gender haistatus if gender !=9, exact • Age by HAI status – Stata command: ttest age_discharge, by(haistatus) • HAI by season – Stata command: tab season haistatus, exact row

Model fitting & Variable Selection • Install spost_9_ado package – It has some nice

Model fitting & Variable Selection • Install spost_9_ado package – It has some nice features for output and goodness of fit • Stata command – – – logit haistatus season xi: logit haistatus i. season, or gen traumai=2 -trauma if trauma !=9 logit haistatus traumai if trauma !=9, or xi: sw, pe(0. 1) pr(0. 2): logit haistatus i. year i. season age_discharge gender atb_admission trauma if gender !=9 & atb_admission !=9 & trauma !=9 • Check goodness of fit – estat gof, group(10)