trend {scan} | R Documentation |
Trend analysis for single-cases data
Description
The trend()
function provides an overview of linear trends in single case
data. By default, it provides the intercept and slope of a linear and
quadratic regression of measurement time on scores. Models are calculated
separately for each phase and across all phases. For more advanced use, you
can add regression models using the R-specific formula class.
Usage
trend(
data,
dvar,
pvar,
mvar,
offset = "deprecated",
first_mt = 0,
model = NULL
)
Arguments
data |
A single-case data frame. See |
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 |
(Deprecated. Please use first_mt). An offset for the first
measurement-time of each phase. If |
first_mt |
A numeric setting the value for the first measurement-time. Default = 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 |
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
Other regression functions:
autocorr()
,
corrected_tau()
,
hplm()
,
mplm()
,
plm()
Examples
## Compute the linear and squared regression for a random single-case
design <- design(slope = 0.5)
matthea <- random_scdf(design)
trend(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(slope = 0.3)
ben <- random_scdf(design)
trend(ben, offset = 0, model = c("Cubic" = values ~ I(mt^3), "Log Time" = values ~ log(mt)))