olmm-gefp {vcrpart}R Documentation

Methods for score processes of olmm objects

Description

Methods to extract and pre-decorrelate the (negative) marginal maximum likelihood observation scores and compute the standardized cumulative score processes of a fitted olmm object.

Usage

olmm_estfun(x, predecor = FALSE, control = predecor_control(),
            nuisance = NULL, ...)

predecor_control(impute = TRUE, seed = NULL, 
                 symmetric = TRUE, center = FALSE,
                 reltol = 1e-6,
                 maxit = 250L, minsize = 1L,
                 include = c("observed", "all"),
                 verbose = FALSE, silent = FALSE)

olmm_gefp(object, scores = NULL, order.by = NULL, subset = NULL,
          predecor = TRUE, parm = NULL, center = TRUE, drop = TRUE,
          silent = FALSE, ...)

Arguments

x, object

a fitted olmm object.

predecor

logical scalar. Indicates whether the within-subject correlation of the estimating equations should be removed by a linear transformation. See details.

control

a list of control parameter as produced by predecor_control.

nuisance

integer vector. Defines the coefficients which are regarded as nuisance and therefore omitted from the transformation.

impute

logical scalar. Whether missing values should be replaced using imputation.

seed

an integer scalar. Specifies the random number used for the set.seed call before the imputation. If set to NULL, set.seed is not processed.

symmetric

logical scalar. Whether the transformation matrix should be symmetric.

minsize

integer scalar. The minimum number of observations for which entries in the transformation should be computed. Higher values will lead to lower accuracy but stabilize the computation.

reltol

convergence tolerance used to compute the transformation matrix.

maxit

the maximum number of iterations used to compute the transformation matrix.

silent

logical scalar. Should the report of warnings be suppressed?

include

logical scalar. Whether the transformation matrix should be computed based on the scores corresponding to observations (option "observed") or on all scores (option "all"), including the imputed values.

verbose

logical scalar. Produces messages.

scores

a function or a matrix. Function to extract the estimating equations from object or a matrix representing the estimating equations. If NULL (default), the olmm_estfun function will be used with argument predecor and additional arguments from ....

order.by

a numeric or factor vector. The explanatory variable to be used to order the entries in the estimating equations. If set to NULL (the default) the observations are assumed to be ordered.

subset

logical vector. For extracts the subset of the estimating equations to be used.

parm

integer, logical or a character vector. Extracts the columns of the estimating equations.

center

logical scalar. TRUE subtracts, if necessary, the column means of the estimating equations.

drop

logical. Whether singularities should be handled automatically (otherwise singularities yield an error).

...

arguments passed to other functions. olmm_gefp passes these arguments to scores if scores is a function.

Details

Complements the estfun method of the package sandwich and the gefp function of the package strucchange for olmm objects. olmm_estfun allows to pre-decorrelate the intra-individual correlation of observation scores, see the argument predecor. The value returned by olmm_gefp may be used for testing coefficient constancy regarding an explanatory variable order.by by the sctest function of package strucchange, see the examples below.

If predecor = TRUE in olmm_estfun, a linear within-subject transformation is applied that removes (approximately) the intra-subject correlation from the scores. Backgrounds are provided by Burgin and Ritschard (2014a).

Given a score matrix produced by olmm_estfun, the empirical fluctuation process can be computed by olmm_gefp. See Zeileis and Hornik (2007). olmm_gefp provides with subset and parm arguments specifically designed for nodewise tests in the tvcm algorithm. Using subset extracts the partial fluctuation process of the selected subset. Further, center = TRUE makes sure that the partial fluctuation process (starts and) ends with zero.

Value

predecor_control returns a list of control parameters for computing the pre-decorrelation transformation matrix. olmm_estfun returns a matrix with the estimating equations and olmm_gefp a list of class class "gefp".

Author(s)

Reto Burgin

References

Zeileis A., Hornik K. (2007), Generalized M-Fluctuation Tests for Parameter Instability, Statistica Neerlandica, 61(4), 488–508.

Burgin R. and Ritschard G. (2015), Tree-Based Varying Coefficient Regression for Longitudinal Ordinal Responses. Computational Statistics & Data Analysis, 86, 65–80.

See Also

olmm

Examples

## ------------------------------------------------------------------- #
## Dummy example :
##
## Testing coefficient constancy on 'z4' of the 'vcrpart_1' data.
## ------------------------------------------------------------------- #

data(vcrpart_1)

## extract a unbalanced subset to show to the full functionality of estfun
vcrpart_1 <- vcrpart_1[-seq(1, 100, 4),]
subset <- vcrpart_1$wave != 1L ## obs. to keep for fluctuation tests
table(table(vcrpart_1$id))

## fit the model
model <- olmm(y ~ treat + re(1|id), data = vcrpart_1)

## extract and pre-decorrelate the scores
scores <- olmm_estfun(
  model, predecor = TRUE,
  control = predecor_control(verbose = TRUE))
attr(scores, "T") # transformation matrix

## compute the empirical fluctuation process
fp <- olmm_gefp(model, scores, order.by = vcrpart_1$z4)

## process a fluctuation test
library(strucchange)
sctest(fp, functional = catL2BB(fp))

[Package vcrpart version 1.0-5 Index]