Multivariate Piecewise linear model / piecewise regression
Source:R/mplm.R
, R/print.sc_mplm.R
mplm.Rd
The mplm()
function computes a multivariate piecewise regression model.
Usage
mplm(
data,
dvar,
mvar,
pvar,
model = c("W", "H-M", "B&L-B", "JW"),
contrast = c("first", "preceding"),
contrast_level = c(NA, "first", "preceding"),
contrast_slope = c(NA, "first", "preceding"),
trend = TRUE,
level = TRUE,
slope = TRUE,
formula = NULL,
update = NULL,
na.action = na.omit,
...
)
# S3 method for sc_mplm
print(x, digits = "auto", std = FALSE, ...)
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.
- mvar
Character string with the name of the measurement time 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.
- model
Model used for calculating the dummy parameters (see Huitema & McKean, 2000). Default is
model = "W"
. Possible values are:"B&L-B"
,"H-M"
,"W"
, and deprecated"JW"
.- contrast
Sets contrast_level and contrast_slope. Either "first", "preceding" or a contrast matrix.
- contrast_level
Either "first", "preceding" or a contrast matrix. If NA contrast_level is a copy of contrast.
- contrast_slope
Either "first", "preceding" or a contrast matrix. If NA contrast_level is a copy of contrast.
- trend
A logical indicating if a trend parameters is included in the model.
- level
A logical indicating if a level parameters is included in the model.
- slope
A logical indicating if a slope parameters is included in the model.
- formula
Defaults to the standard piecewise regression model. The parameter phase followed by the phase name (e.g.,
phaseB
) indicates the level effect of the corresponding phase. The parameter 'inter' followed by the phase name (e.g.,interB
) adresses the slope effect based on the method provide in the model argument (e.g.,"B&L-B"
). The formula can be changed for example to include further variables into the regression model.- update
An easier way to change the regression formula (e.g.,
. ~ . + newvariable
).- na.action
Defines how to deal with missing values.
- ...
Further arguments passed to the
lm()
function.- x
Object returned from
mplm()
.- digits
The minimum number of significant digits to be use. If set to "auto" (default), values are predefined.
- std
If TRUE, a table with standardized estimates is included.
Value
model | Character string from function call (see arguments above). |
contrast | List with contrast definitions. |
full.model | Full regression model list. |
formula | Formula of the mplm model. |
See also
Other regression functions:
autocorr()
,
corrected_tau()
,
hplm()
,
plm()
,
trend()
Examples
res <- mplm(Leidig2018$`1a1`,
dvar = c("academic_engagement", "disruptive_behavior")
)
print(res)
#> Multivariate piecewise linear model
#>
#> Dummy model: W level = first, slope = first
#>
#> Coefficients:
#> academic_engagement disruptive_behavior
#> (Intercept) 2.771 0.8493
#> Trend -0.216 0.0822
#> Level Phase B 2.340 -1.3898
#> Slope Phase B 0.219 -0.0803
#>
#> Formula: y ~ 1 + mt + phaseB + interB
#>
#> Type III MANOVA Tests: Pillai test statistic
#> Df test stat approx F num Df den Df Pr(>F)
#> (Intercept) 1 0.2841 15.48 2 78 2.2e-06 ***
#> Trend 1 0.0317 1.28 2 78 0.28519
#> Level Phase B 1 0.1905 9.18 2 78 0.00026 ***
#> Slope Phase B 1 0.0315 1.27 2 78 0.28737
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#>
#> The following variables were used in this analysis:
#> 'academic_engagement/ disruptive_behavior' as dependent variable, 'phase' as phase variable, and 'mt' as measurement-time variable.
## also report standardized coefficients:
print(res, std = TRUE)
#> Multivariate piecewise linear model
#>
#> Dummy model: W level = first, slope = first
#>
#> Coefficients:
#> academic_engagement disruptive_behavior
#> (Intercept) 2.771 0.8493
#> Trend -0.216 0.0822
#> Level Phase B 2.340 -1.3898
#> Slope Phase B 0.219 -0.0803
#>
#> Standardized coefficients:
#> academic_engagement disruptive_behavior
#> (Intercept) 0.000 0.000
#> Trend -5.979 5.107
#> Level Phase B 0.576 -0.767
#> Slope Phase B 5.950 -4.897
#>
#> Formula: y ~ 1 + mt + phaseB + interB
#>
#> Type III MANOVA Tests: Pillai test statistic
#> Df test stat approx F num Df den Df Pr(>F)
#> (Intercept) 1 0.2841 15.48 2 78 2.2e-06 ***
#> Trend 1 0.0317 1.28 2 78 0.28519
#> Level Phase B 1 0.1905 9.18 2 78 0.00026 ***
#> Slope Phase B 1 0.0315 1.27 2 78 0.28737
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#>
#> The following variables were used in this analysis:
#> 'academic_engagement/ disruptive_behavior' as dependent variable, 'phase' as phase variable, and 'mt' as measurement-time variable.