Learn R Programming

MethComp (version 1.30.2)

predict.PBreg: Predict results from PBreg object

Description

A predict method for the "PBreg" class object, that is a result of Passing-Bablok regression.

Usage

# S3 method for PBreg
predict(
  object,
  newdata = object$model$x,
  interval = "confidence",
  level = 0.95,
  ...
)

Value

If interval is "confidence" this function returns a data frame with three columns: "fit", "lwr" and "upr" - similarly to predict.lm.

If interval is "none" a vector of predicted values is returned.

Arguments

object

an object of class "PBreg".

newdata

an optional vector of new values of x to make predictions for. If omitted, the fitted values will be used.

interval

type of interval calculation - either confidence or none. The former is the default.

level

String. The type of interval to compute. Either "tolerance" or "confidence" (the default).

...

Not used

Author

Michal J. Figurski mfigrs@gmail.com

Examples

Run this code
## Model data frame generation
a <- data.frame(x=seq(1, 30)+rnorm(mean=0, sd=1, n=30),
                y=seq(1, 30)*rnorm(mean=1, sd=0.4, n=30))

## Call to PBreg
x <- PBreg(a)
print(x)
predict(x, interval="none")

## Or the same using "Meth" object
a <- Meth(a, y=1:2)
x <- PBreg(a)
print(x)
predict(x)

Run the code above in your browser using DataLab