Learn R Programming

SSDforR (version 1.1)

Pchart: SPC P-chart

Description

This function builds a P-chart and can be used when the target behavior has a binary outcome. This chart allows for a comparison of the proportion of tasks completed over time or between phases. A space separates each phase.

Usage

Pchart(behavior, groupX, bandX, ABxlab, ABylab, ABmain)

Arguments

behavior
behavior variable
groupX
grouping variable
bandX
number of standard deviations desired (e.g., 2)
ABxlab
label for x-axis between quotation marks (e.g., "weeks")
ABylab
label for y-axis between quotation marks (e.g., "attendance"")
ABmain
main title for chart between quotation marks (e.g., "Attendance Over Time")

References

{Orme, J. & Cox, M.E. (2001). Analyzing single-subject design data using statistical proces control charts. Social Work Research, 25(2), 115-127.

} {Go to www.ssdanalysis.com for more information.}

Examples

Run this code
attend<-c(0,0,0,1,0,0,1,0,0,1,0,0,1,0,1,0,0,0,0,0,1,1,0,0,1,NA,
0,1,1,0,1,1,0,1,1,1,0,1,0,0,1,1,1,1,0,0,1,1,0,1,0,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)

day<-c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4,5,5,5,5,5,NA,6,6,6,6,6,7,7,7,7,7,
8,8,8,8,8,9,9,9,9,9,10,10,10,10,10,11,11,11,11,11,12,12,12,12,12,13,
13,13,13,13,14,14,14,14,14,15,15,15,15,15)
Pchart(attend, day, 2, "week", "amount", "Group attendance")

Run the code above in your browser using DataLab