Learn R Programming

SSDforR (version 1.4.8)

GABrf2: Autocorrelation for group data

Description

This function tests for lag-1 autocorrelation for group data. This should be used any time the sample size is less than six. Any phase can be tested. Also produces regression line graph.

Usage

GABrf2(behavior, phaseX, timeX, v1)

Arguments

behavior
behavior variable
phaseX
phase variable
timeX
time variable (e.g., week)
v1
letter of phase being tested in quotation marks (e.g., "A")

References

Auerbach, Charles, and Zeitlin Wendy. SSD for R: An R Package for Analyzing Single-Subject Data. Oxford University Press, 2014. p99, p101, p147

{Huitema, B.F. & McKean, J.W. (1994). Two reduced-biased autocorrelation estimators: rF1 and rF2. Perceptual and Motor Skills, 78(1), 323-330.

} {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)

week<-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)

pattend<-c("A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A",
"A","A","A","A","A",
"A","A","A",NA,"B","B","B","B","B","B","B","B","B","B","B","B","B","B","B"
,"B","B","B",
"B","B","B","B","B","B","B","B","B","B","B","B","B","B",
"B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B")
GABrf2(attend,pattend,week,"A")

Run the code above in your browser using DataLab