Learn R Programming

scan (version 0.20)

trendSC: 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 the A phase, the B-phase, and the whole data. For a more advanced application, you can add regression models using the R specific formula class.

Usage

trendSC(data, B.offset = -1, model = NA)

Arguments

data

A single-case data frame. See makeSCDF to learn about this format.

B.offset

An offset for the first phase B measurement-time (MT). If set B.offset = 0, the first phase B measurement is handled as MT 1. Default is B.offset = -1, making the first value of phase B MT = 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.

Value

trend

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

B.offset

Numeric argument from function call (see Arguments section).

See Also

describeSC, overlapSC, plm, hplm

Examples

Run this code
# NOT RUN {
## Compute the linear and squared regression for a random single-case
matthea <- rSC(d.slope = 0.5)
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.
ben <- rSC(d.slope = 0.3)
trendSC(ben, B.offset = 0, model = c("Cubic" = "values ~ I(mt^3)", "Log Time" = "values ~ log(mt)"))
# }

Run the code above in your browser using DataLab