Learn R Programming

robustloggamma (version 1.0-2.1)

loggammacenslmrob: Robust estimation of an Accelerated Failure Time model with extended Log Gamma errors in presence of censored observations.

Description

Three different type of robust procedures are provided for the estimation of the parameters in an Accelerated Failure Time model with extended Log Gamma errors in presence of censored observations. Maximum Likelihood is also provided.

Usage

loggammacenslmrob(formula, delta, data, subset, weights,
  na.action, method = c("oneTML", "oneWL", "TWQTau", "TQTau",
  "ML"), model = TRUE, x = !control$compute.rd, y = FALSE,
  singular.ok = TRUE, contrasts = NULL, offset = NULL,
  control = NULL, init = NULL, ...)

Arguments

formula

a symbolic description of the model to be fit. See lm and formula for more details.

delta

numeric, 0 or 1. 0 indicated censored observations.

data

an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which loggammacenslmrob is called.

subset

an optional vector specifying a subset of observations to be used in the fitting process.

weights

an optional vector of weights to be used in the fitting process (in addition to the robustness weights computed in the fitting process).

na.action

a function which indicates what should happen when the data contain NAs. The default is set by the na.action setting of options, and is na.fail if that is unset. The “factory-fresh” default is na.omit. Another possible value is NULL, no action. Value na.exclude can be useful.

method

string specifying the estimator-chain. Default is TML one step.

model, x, y

logicals. If TRUE the corresponding components of the fit (the model frame, the model matrix, the response) are returned.

singular.ok

logical. If FALSE (the default in S but not in R) a singular fit is an error.

contrasts

an optional list. See the contrasts.arg of model.matrix.default.

offset

this can be used to specify an a priori known component to be included in the linear predictor during fitting. An offset term can be included in the formula instead or as well, and if both are specified their sum is used.

control

a list specifying control parameters; use the function loggammarob.control and see its help page.

init

an optional argument to specify or supply the initial estimate. See Details.

additional arguments can be used to specify control parameters directly instead of (but not in addition to!) via control.

Value

An object of class lmrob; a list including the following components:

coefficients

The estimate of the coefficient vector for the regression part. First element is the intercept and it would be equals to the parameter mu.

mu

The estimate of the intercept parameter.

sigma

The estimate of the scale parameter.

lambda

The estimate of the shape parameter.

fitted.values

Fitted values associated with the estimator.

residuals

Residuals associated with the estimator.

cut.lower, cut.upper

Cut points for the method based on TML (missing for the other methods).

iter

number of iterations.

weights

the specified weights (missing if none were used).

errors

errors messages.

n.ret

number of non zero robust weights for the method based on TML.

control

control argument.

converged

TRUE if the procedure converged.

method

method used during the fit.

rank

the numeric rank of the fitted linear model.

rweights

the “robustness weights”.

df.residual

the residual degrees of freedom.

degree.freedom

the same as df.residual

delta

as in input.

df

a vector with 3 components: (number of linearly independent regressors, df.residual, number of regressors).

xlevels

(only where relevant) a record of the levels of the factors used in fitting.

call

the matched call.

terms

the terms object used.

%assign
model

if requested (the default), the model frame used.

x

if requested, the model matrix used.

y

if requested, the response used.

scale

square root of the sigma parameter.

na.action

(where relevant) information returned by model.frame on the special handling of NAs.

offset

the offset used (missing if none were used).

contrasts

(only where relevant) the contrasts used.

In addition, non-null fits will have qr relating to the linear fit, for use by extractor functions such as summary.

References

C. Agostinelli, I. Locatelli, A. Marazzi and V.J. Yohai (2015) Robust estimators of accelerated failure time regression with generalized log-gamma errors. Submitted.

See Also

loggammacensrob for the case of censored observations without covariates.

Examples

Run this code
# NOT RUN {
  
# }
# NOT RUN {
    n <- 50
    p <- 2
    set.seed(1234)
    X <- matrix(rnorm(p*n, sd=2), ncol=p)
    mu <- 2
    beta <- rep(2,p)
    sigma <- 2
    lambda <- 1
    linear <- mu + X<!-- %*%beta -->
    y <- rloggamma(n=n, mu=linear, sigma=sigma, lambda=lambda)
    cens <- rloggamma(n=n, mu=linear+3, sigma=sigma, lambda=lambda)
    delta <- as.numeric(y <= cens)
    y[delta==0] <- cens[delta==0]
    x <- data.frame(y=as.vector(y), x1=X[,1], x2=X[,2])
    res <- loggammacenslmrob(y~x1+x2, delta=delta, data=x)
    summary(res)
  
# }

Run the code above in your browser using DataLab