Residuals of a fitted carx object

Description

Computes the residuals of fitted carx object. When no censoring is present, the ordinary residuals will be computed. Otherwise, the simulated residuals (Gourieroux, Monfort, Renault, and Trognon 1987) of a fitted carx object will be computed, as suggested in Wang and Chan (2015).

Usage

1
2
3
## S3 method for class 'carx'
residuals(object, type = c("raw", "pearson"), seed = NULL,
  ...)

Arguments

object

a fitted carx object.

type

a string indicates which type of residual is to be returned. "raw" returns the (simulated) residuals; "pearson" returns the raw residuals divided by estimated standard error of the residuals.

seed

the seed for the random number generator.

...

not used.

Details

The simulated residuals are constructed as follows. First, impute each unobserved Y_t^* by a (random) realization from the conditional distribution D(Y_t^*|\{(Y_s,X_s)\}_{s=1}^t), evaluated at the parameter estimate. Then, refit the model with (Y_t^* , X_t) so obtained, via the method of conditional maximum likelihood; the residuals from the latter model are the simulated residuals \varepsilon_t.

Value

the simulated residuals.

References

Gourieroux C, Monfort A, Renault E, Trognon A (1987). "Simulated residuals." Journal of Econometrics, 34(1), 201-252.

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

Examples

1
2
3
4
5
6
dat = carxSim(nObs=100,seed=0)
mdl <- carx(y~X1+X2-1,data=dat, p=2, CI.compute = FALSE)
#compute the raw residuals
res = residuals(mdl,type="raw")
#compute the Pearson residuals
res = residuals(mdl,type="pearson")

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