Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

trend

Trend analysis for single-cases data


Description

The trendSC function provides an overview of linear trends in single-case data. By default, it gives you the intercept and slope of a linear and a squared regression of measurement-time on scores. Models are computed separately for each phase and across all phases. For a more advanced application, you can add regression models using the R specific formula class.

Usage

trend(data, dvar, pvar, mvar, offset = -1, model = NULL)

trendSC(...)

Arguments

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.

offset

An offset for the first measurement-time of each phase (MT). If set offset = 0, the phase measurement is handled as MT 1. Default is offset = -1, setting the first value of MT to 0.

model

A string or a list of (named) strings each depicting one regression model. This is a formula expression of the standard R class. The parameters of the model are values, mt and phase.

...

Further arguments passed to the function.

Value

trend

A matrix containing the results (Intercept, B and beta) of separate regression models for phase A, phase B, and the whole data.

offset

Numeric argument from function call (see Arguments section).

Author(s)

Juergen Wilbert

See Also

Examples

## Compute the linear and squared regression for a random single-case
design <- design_rSC(slope = 0.5)
matthea <- rSC(design)
trendSC(matthea)

## Besides the linear and squared regression models compute two custom models:
## a) a cubic model, and b) the values predicted by the natural logarithm of the
## measurement time.
design <- design_rSC(slope = 0.3)
ben <- rSC(design)
trend(ben, offset = 0, model = c("Cubic" = values ~ I(mt^3), "Log Time" = values ~ log(mt)))

scan

Single-Case Data Analyses for Single and Multiple Baseline Designs

v0.51
GPL
Authors
Juergen Wilbert [aut, cre], Timo Lueke [aut]
Initial release
2021-2-11

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.