carx.default: The default estimation method for a CARX model

Description Usage Arguments Value See Also Examples

View source: R/carx_default.R

Description

Estimate a CARX model, and compute the standard errors and confidence intervals of the parameter estimates by parametric bootstrap.

Usage

1
2
3
4
5
6
7
## Default S3 method:
carx(y, x = NULL, ci = NULL, lcl = NULL, ucl = NULL,
  p = 1, prmtrX = NULL, prmtrAR = NULL, sigma = NULL,
  y.na.action = c("skip", "as.censored"), addMu = TRUE, tol = 1e-04,
  max.iter = 500, CI.compute = FALSE, CI.level = 0.95, b = 1000,
  b.robust = FALSE, b.show.progress = FALSE, init.method = c("biased",
  "consistent"), cenTS = NULL, verbose = FALSE, seed = NULL, ...)

Arguments

y

a vector of possibly censored responses.

x

a matrix of covariates, or some object which can be coerced to matrix. Default=NULL, indicating a pure AR model for y.

ci

a vector of numeric values. If its i-th value is zero (negative, positive), then the corresponding element of y is uncensored (left, right censored). Default = NULL, indicating no censoring.

lcl

a vector of lower censoring limits, or a number assuming constant limit. Default = NULL, indicating no lower censoring limit.

ucl

a vector of upper censoring limits, or a number assuming constant limit. Default = NULL, indicating no upper censoring limit.

p

the AR order for the regression errors. Default = 1.

prmtrX

the initial values of the regression parameters for x. Default = NULL.

prmtrAR

the initial values of the AR coefficients. Default = NULL.

sigma

the initial value of the innovation (noise) standard deviation. Default = NULL.

y.na.action

a string indicating how to deal with missing (NA) values in y. If it is set to "skip" (default), cases containing a missing value will be skipped, so that the estimating equation of future cases will be conditional on the most recent p complete cases after the skipped case. If "as.censored", the y value will be treated as left-censored with lower censoring limit replaced by positive infinity. The user may choose to use "skip" if there exist few long gaps in the time series of response. Use "as.censored" if the missing values in y are many and scattered in time. N.B.: The presence of any missing values in x will automatically hard-code y.na.action to be "skip".

addMu

logical, indicating whether to include an intercept in case x=NULL. Default = TRUE.

tol

the tolerance level used in the stopping criterion. Default = 1.0e-4.

max.iter

maximum number of iterations allowed in the optimization. Default = 100.

CI.compute

logical value to indicate whether to compute the confidence intervals for the parameters. Default = FALSE, as it can be time-consuming to run the parametric bootstrap.

CI.level

numeric value in (0,1) representing the confidence level. Default = 0.95.

b

number of bootstrap replicates used for computing the boostrap confidence intervals. Default = 1000.

b.robust

logical, if TRUE, the innovations are re-sampled from the simulated residuals; otherwise they are re-sampled from a centered normal distribution with the estimated standard deviation. Default = FALSE.

b.show.progress

logical, if TRUE, a text bar will be displayed to show the progress of bootstrap when computing the confidence intervals of the parameter estimates.

init.method

a string selecting a procedure ("biased", or "consistent") for deteriming the initial values, in case there are no initial values for some parameters, i.e., one of prmtrX, prmtrAR, sigma is NULL. The "biased" method is always available, as it uses maximum gaussian likelihood estimator with the data replacing any censored observation by its corresponding censoring limit. The "consistent" method is only available for left censored data. Note that the "consistent" method may produce initial estimates with non-stationary AR coefficients or negative innovation variance, in which case, the function will fall back to the "biased" method for constucting the initial values (when this happens, the attribute fallBackToBiased of the returned object will be set to TRUE.) Default="biased".

cenTS

an optional argument to pass a cenTS object which contain the data used, when carx.formula is invoked. Default = NULL.

verbose

logical value indicates whether to print intermediate results for monitoring the the progress of the iterative estimation procedure. Default = FALSE.

seed

the random seed initialized at the beginning of the function. If a valid seed is supplied, the function will first store the current seed and set the seed according to the supplied seed, then restore the seed upon exit. Default = NULL.

...

not used.

Value

a CARX object of the estimated model.

See Also

cenTS on how to construct a cenTS object.

Examples

1
2
3
4
dat = carxSim(nObs=100,seed=0)
mdl <- carx(y=dat$y, x=dat[,c("X1","X2")], ci=dat$ci, lcl=dat$lcl, ucl=dat$ucl, p=2)
#or simply call
mdl <- carx(y~X1+X2-1,data=dat, p=2, CI.compute = FALSE)

Example output



carx documentation built on May 2, 2019, 3:43 a.m.

Related to carx.default in carx...