predict: Obtain predicted values from 'ipriorMod' objects

Description Usage Arguments Value Examples

Description

Obtain predicted values from ipriorMod objects

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## S3 method for class 'ipriorMod'
fitted(object, intervals = FALSE, alpha = 0.05,
  ...)

## S3 method for class 'ipriorMod'
predict(object, newdata = list(), y.test = NULL,
  intervals = FALSE, alpha = 0.05, ...)

## S3 method for class 'ipriorPredict'
print(x, rows = 10, dp = 3, ...)

Arguments

object, x

An ipriorMod object.

intervals

Logical. Calculate the credibility intervals for the fitted values. Defaults to FALSE.

alpha

The significance level for the credibility intervals. This is a number between 0 and 1.

...

Not used.

newdata

Either a data frame when using formula method, or a list of vectors/matrices if using default method. Either way, the new data must be structurally similar to the original data used to fit the model.

y.test

(Optional) Test data, in order to compute test error rates.

rows

(Optional) The number of values/rows to display.

dp

(Optional) Decimal places for the values.

Value

A list of class ipriorPredict containing the fitted values, residuals (observed minus fitted), the training mean squared error, and the lower and upper intervals (if called).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
dat <- gen_smooth(20)
mod <- iprior(y ~ ., dat, kernel = "se")
fitted(mod)
fitted(mod, intervals = TRUE)
predict(mod, gen_smooth(5))

with(dat, mod <<- iprior(y, X, kernel = "poly"))
newdat <- gen_smooth(30)
mod.pred <- predict(mod, list(newdat$X), y.test = newdat$y, intervals = TRUE)
str(mod.pred)
print(mod.pred, row = 5)

iprior documentation built on March 20, 2019, 5:04 p.m.