Learn R Programming

carx (version 0.7.1)

fitted.carx: Fitted values of a carx object

Description

Compute the fitted values from a carx object. Note that the existence of censoring invalidates the usual Markov property for an AR model. Instead, the conditional distribution of \(Y^*_t\) given the past \(Y\)s and current and past covariates is the same as the conditional distribution \(D_t = D(Y^*_t|X_t, {(Y_{j}, X_j )}_{j=\tau}^{t-1} )\), where \(1 \le \tau \le t-p\) is the largest integer \(t\) such that none of \(Y_t;t=\tau+p-1,...,\tau\) is censored. In the case that \(\tau = t-p\), the fitted value can be readily computed; otherwise, the fitted value is computed as the mean of the distribution \(D_t\) by the function mtmvnorm from the package tmvtnorm.

Usage

# S3 method for carx
fitted(object, ...)

Arguments

object

a fitted carx object.

...

not used.

Value

the fitted values.

Examples

Run this code
# NOT RUN {
dat = carxSim(nObs=100,seed=0)
mdl <- carx(y~X1+X2-1,data=dat, p=2, CI.compute = FALSE)
#compute the fitted values
fv = fitted(mdl)
# }

Run the code above in your browser using DataLab