Detect all outliers of a carx object

Share:

Description

Detect all outliers of a carx object and update the model if any outlier is detected. It tests for the presence of outliers one at a time, for each time point, adjusted for multiplicity of testing, as described in Wang and Chan (2015).

Usage

1
2
## S3 method for class 'carx'
outlier(object, outlier.prefix = "OI_", seed = NULL)

Arguments

object

a carx object.

outlier.prefix

the prefix used to construct variable name for indicator variables representing the detected outliers, default = "OI_".

seed

the seed for randon number generator, default=NULL.

Value

an updated carx object. If any outlier is detected, its index will be stored in the outlier.indices attribute of the return object, and prefix for variable name is stored in the outlier.prefix attribute. Note that if the original object is fitted through a formula interface, the formula will also be updated.

References

Wang C, Chan KS (2015). "Quasi-likelihood estimation of a censored autoregressive model with exogenous variables." Submitted.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
sigma = 0.6
nObs = 100
dat = carxSimCenTS(nObs=nObs,sigma=sigma,ucl=Inf)
dat$y[as.integer(nObs/2)] = dat$y[as.integer(nObs/2)] + 4*sd(dat$y)
mdl <- carx(y~X1+X2-1,data=dat, p=2, CI.compute = FALSE)
oc = outlier(mdl)
#note the outlier indices in the output:
print(oc)
#note the updated formula:
print(formula(oc))

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.