140 likes | 284 Views
Statistical Process Control Charts Barbara Williams. Stata Conference Columbus, OH July 31, 2015. Introduction.
E N D
Statistical Process Control ChartsBarbara Williams Stata Conference Columbus, OH July 31, 2015
Introduction Statistical Process Control (SPC) Charts are used to assess outcomes measured over time, usually with the purpose of detecting improvement or maintaining a high level of performance. Traditionally used in industrial engineering for quality control.
Introduction SPC Charts are now the standard for quality improvement work in healthcare Stata options for creating reader-friendly SPC charts are limited Objective: • generate useful and easy-to-read SPC charts in Stata. • build on existing Stata cchart (count) and pchart (proportion) commands Replace current SPC chart generators in Excel and stand-alone programs I am using Stata MP12
Our Research Acute respiratory infection is a common reason for medical care Most are self-limited viral illnesses not responsive to antibiotics Antibiotic prescription is common (up to 46%) adding high cost and contributing to antibiotic resistant bacteria New respiratory infection care pathway of nurse telephone care coupled with provider education instead of a doctor office visit Determine the impact of this new pathway on the number of visits with a prescription for antibiotics
Our Data . list, clean noobs VisitIDMonthYearAbxYes 1 2013m5 0 2 2013m11 1 3 2010m8 1 4 2012m8 0 5 2011m2 0 6 2011m5 0 7 2012m5 0 8 2012m9 0 9 2013m2 1 10 2013m5 0 11 2010m7 1 12 2012m3 0 13 2012m2 0 14 2012m11 0 15 2013m2 0 16 2013m5 0
P-Charts Default Stata P-Chart (Proportion of visits with a prescription) . collapse (sum) AbxSum= AbxYes (count) VisitSum = AbxYes, by(ServiceMonthYear) . pchartAbxSum ServiceMonthYear VisitSum
P-Charts * intervention to reduce antibiotic prescriptions was carried out in March 2012 generate InterveneMonthYear = tm(2012m3) * Before Intervention preserve collapse (sum) AbxSum= AbxYes (count) VisitSum= AbxYes (first) InterveneMonthYear /// if ServiceMonthYear < InterveneMonthYear, by(ServiceMonthYear) pchartAbxSumServiceMonthYearVisitSum, /// generate(Average LCL UCL) /// nograph save "P:\My Documents\temp1.dta", replace restore * After Intervention preserve collapse (sum) AbxSum= AbxYes (count) VisitSum= AbxYes (first) InterveneMonthYear /// if ServiceMonthYear>= InterveneMonthYear, by(ServiceMonthYear) pchartAbxSumServiceMonthYearVisitSum, /// generate(Average LCL UCL) /// nograph save "P:\My Documents\temp2.dta", replace * Merge append using "P:\My Documents\temp1.dta"
P-Charts sort ServiceMonthYear egenbeforemean = mean(Average) if ServiceMonthYear < InterveneMonthYear egenaftermean = mean(Average) if ServiceMonthYear >=InterveneMonthYear twoway (line beforemeanServiceMonthYear if ServiceMonthYear < InterveneMonthYear, lcolor(gray)) || /// (line aftermeanServiceMonthYear if ServiceMonthYear >= InterveneMonthYear, lcolor(gray)) || /// (line LCL ServiceMonthYear if ServiceMonthYear < InterveneMonthYear, lcolor(gray) lpattern(dash) connect(stairstep)) || /// (line UCL ServiceMonthYear if ServiceMonthYear < InterveneMonthYear, lcolor(gray) lpattern(dash) connect(stairstep)) || /// (line LCL ServiceMonthYear if ServiceMonthYear>=InterveneMonthYear, lcolor(gray) lpattern(dash) connect(stairstep)) || /// (line UCL ServiceMonthYear if ServiceMonthYear>=InterveneMonthYear, lcolor(gray) lpattern(dash) connect(stairstep)) || /// (connected Average ServiceMonthYear if ServiceMonthYear<=InterveneMonthYear, lcolor(black) mcolor(black) mfcolor(white)) || /// (connected Average ServiceMonthYear if ServiceMonthYear >= InterveneMonthYear, lcolor(black) mcolor(black)), /// text(.57 630 "Mean = .57" ,size(medium)) text(.365 620 "Mean = .36" ,size(medium)) /// text(.64 602 "UCL" ,size(small)) text(.51 602 "LCL" ,size(small)) /// ytitle(Proportion of Encounters with Antibiotics) ylabel(.0(.1)1.0, angle(horizontal) format(%5.1f)) /// xtitle(Encounter Month Year) xlabel(#5, format(%tm_m_Y)) xmtick(##12) legend(off) xsc(titlegap(1)) restore
C-Charts Default Stata C-Chart (Count of antibiotic prescriptions in first 100 visits by month) . cchartAbxSumServiceMonthYear
C-Charts * Before Intervention preserve collapse (sum) AbxSum= AbxYes (first) InterveneMonthYear if /// ServiceMonthYear< InterveneMonthYear, by(ServiceMonthYear) egen Average = mean(AbxSum) generate LCL = Average - 3*(sqrt(Average)) generate UCL = Average + 3*(sqrt(Average)) twoway (connected AbxSumServiceMonthYear) || /// (line LCL ServiceMonthYear) || /// (line UCL ServiceMonthYear) save "P:\My Documents\temp1.dta", replace restore * After Intervention preserve collapse (sum) AbxSum= AbxYes (first) InterveneMonthYear if /// ServiceMonthYear>= InterveneMonthYear, by(ServiceMonthYear) egen Average = mean(AbxSum) generate LCL = Average - 3*(sqrt(Average)) generate UCL = Average + 3*(sqrt(Average)) twoway (connected AbxSumServiceMonthYear) || /// (line LCL ServiceMonthYear) || /// (line UCL ServiceMonthYear) save "P:\My Documents\temp2.dta", replace * Merge append using "P:\My Documents\temp1.dta"
C-Charts sort ServiceMonthYear egenbeforemean = mean(Average) if ServiceMonthYear < InterveneMonthYear egenaftermean= mean(Average) if ServiceMonthYear >=InterveneMonthYear twoway (line beforemeanServiceMonthYear if ServiceMonthYear < InterveneMonthYear, lcolor(gray)) || /// (line aftermeanServiceMonthYear if ServiceMonthYear >=InterveneMonthYear, lcolor(gray)) || /// (line LCL ServiceMonthYear if ServiceMonthYear < InterveneMonthYear, lcolor(gray) lpattern(dash) connect(stairstep)) || /// (line UCL ServiceMonthYear if ServiceMonthYear < InterveneMonthYear, lcolor(gray) lpattern(dash) connect(stairstep)) || /// (line LCL ServiceMonthYear if ServiceMonthYear >=InterveneMonthYear, lcolor(gray) lpattern(dash) connect(stairstep)) || /// (line UCL ServiceMonthYear if ServiceMonthYear >=InterveneMonthYear, lcolor(gray) lpattern(dash) connect(stairstep)) || /// (connected AbxSumServiceMonthYear if ServiceMonthYear < InterveneMonthYear, lcolor(black) mcolor(black) mfcolor(white)) || /// (connected AbxSumServiceMonthYear if ServiceMonthYear >=InterveneMonthYear, lcolor(black) mcolor(black)), /// text(68 618 "Mean = 57" ,size(medium)) text(47 640 "Mean = 37" ,size(medium)) /// text(76 602 "UCL" ,size(small)) text(40 602 "LCL" ,size(small)) /// ytitle(Number of Antibiotic Prescriptions) ylabel(0(10)100, angle(horizontal) format(%5.0f)) /// xtitle(Encounter Month Year) xlabel(#5, format(%tm_m_Y)) xmtick(##12) legend(off) xsc(titlegap(1)) restore