autocorr: Autocorrelation for single-case data

View source: R/autocorr.R

print.sc_acR Documentation

Autocorrelation for single-case data

Description

The autocorr function calculates autocorrelations within each phase and across all phases.

Usage

## S3 method for class 'sc_ac'
print(x, digits = "auto", ...)

## S3 method for class 'sc_ac'
export(object, caption = NA, footnote = NA, filename = NA, round = 3, ...)

autocorr(data, dvar, pvar, mvar, lag_max = 3, lag.max, ...)

Arguments

x

An object returned by autocorr()

digits

The minimum number of significant digits to be use. If set to "auto" (default), values are predefined.

...

Further arguments passed to the acf() function

object

An scdf or an object exported from a scan function.

caption

Character string with table caption. If left NA (default) a caption will be created based on the exported object.

footnote

Character string with table footnote. If left NA (default) a footnote will be created based on the exported object.

filename

String containing the file name. If a filename is given the output will be written to that file.

round

Integer passed to the digits argument used to round values.

data

A single-case data frame. See scdf() to learn about this format.

dvar

Character string with the name of the dependent variable. Defaults to the attributes in the scdf file.

pvar

Character string with the name of the phase variable. Defaults to the attributes in the scdf file.

mvar

Character string with the name of the measurement time variable. Defaults to the attributes in the scdf file.

lag_max, lag.max

The lag up to which autocorrelations will be computed.

Value

A data frame containing separate autocorrelations for each phase and for all phases (for each single-case). If lag_max exceeds the length of a phase minus one, NA is returned for this cell.

Functions

  • print(sc_ac): Print method

  • export(sc_ac): Export results to html

Author(s)

Juergen Wilbert

See Also

acf()

Other regression functions: bplm(), hplm(), mplm(), plm(), print.sc_bctau(), trend()

Examples

## Compute autocorrelations for a list of four single-cases up to lag 2.
autocorr(Huber2014, lag_max = 2)

scan documentation built on Sept. 11, 2025, 5:12 p.m.