predict.outference: Make predictions from an '"outference"' object

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/outference.R

Description

This function gives predictions as well as confidence intervals for the regression surfaces and the prediction intervals from an "outference" object. The syntax is the same as predict.lm.

Usage

1
2
3
## S3 method for class 'outference'
predict(object, newdata, interval = c("none",
  "confidence", "prediction"), level = 0.95, alpha.tilde = NULL, ...)

Arguments

object

an object of class "outference".

newdata,

an optional data frame in which to look for variables with which to predict. If omitted, the fitted values are used. WARNING: making predictions for many new data points with interval = "confidence" or "prediction" can be time-consuming, since for each data point, the function needs to compute the truncation set and solve the roots for a truncated survival function.

interval,

type of interval calculation. If set to "none", then only point predictions are made; if set to "confidence", then this function returns confidence intervals for the regression surface; if set to "prediction", then this function returns the prediction intervals.

level,

confidence level, default to 0.95.

alpha.tilde,

an extra parameter between 0 and 1-level, which is used when computing prediction intervals. If left NULL, then this function searches the alpha.tilde that gives shortest prediction intervals. See also 'details'.

...,

other arguments.

Details

If alpha.tilde = NULL, then this function iterates over alpha.tilde in seq(0, 1-level, length.out = 100)[c(5, 25, 50, 75, 95)] and returns the results with the shortest prediction intervals.

Value

This function gives a vector of predictions or a matrix of predictions and intervals with column names fit, lwr, upr if interval is set.

Author(s)

Shuxiao Chen <[email protected]>

See Also

outference for model fitting;

summary.outference for summaries;

coef.outference for extracting coefficients;

confint.outference for confidence intervals of regression coefficients;

plot.outference for plotting the outlying measure;

Examples

1
2
3
4
5
6
7
8
9
## Brownlee’s Stack Loss Plant Data
data("stackloss")
## fit the model
## detect outlier using Cook's distance with cutoff = 4
fit <- outference(stack.loss ~ ., data = stackloss, method = "cook", cutoff = 4)
## predictions at the first two observations
predict(fit, newdata = stackloss[1:2, ], interval = "none")
predict(fit, newdata = stackloss[1:2, ], interval = "confidence")
predict(fit, newdata = stackloss[1:2, ], interval = "prediction")

shuxiaoc/outference documentation built on Dec. 5, 2017, 3:48 a.m.