if (FALSE) {
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)
}
Run the code above in your browser using DataLab