predict.TML {RobustAFT} | R Documentation |
Predict method for "TML" objects
Description
Obtains predictions from a fitted Truncated Maximum Likelihood (TML) object.
Usage
## S3 method for class 'TML'
predict(object, newdata = NULL, ...)
Arguments
object |
An object of class "TML", usually, a result of a call to |
newdata |
Optionally, a vector, a matrix or a data frame containing the variables with which to predict.
If omitted, the fitted values of |
... |
Additional arguments affecting the predictions produced. |
Details
newdata
must have the same number of variables (that is of columns) as the model.
If object
is a model with an intercept, newdata
must have a first column of 1.
Value
Returns a vector of predictions.
See Also
TML.noncensored
, TML.censored
, predict
Examples
## Not run:
data(D243)
Cost <- D243$Cost # Cost (Swiss francs)
LOS <- D243$LOS # Length of stay (days)
Adm <- D243$Typadm; Adm <- (Adm==" Urg")*1 # Type of admission
# (0=on notification, 1=Emergency)
# Fitting the model
z <- TML.noncensored(log(Cost)~log(LOS)+Adm, errors="logWeibull")
# With a vector of data
vec <- c(1, 2.4, 1)
predict(object = z, newdata = vec)
# With a matrix of data
mat <- matrix(c(1,1,2.4,2.7,1,0), ncol=3)
predict(z, mat)
# With a data frame
dat <- as.data.frame(cbind("intercept"=c(1,1,1), "log(LOS)"=c(2.4,2.7,2.2),
"Adm"=c(1,0,1)))
predict(z, dat)
## End(Not run)
[Package RobustAFT version 1.4-7 Index]