predict.bfsl {bfsl}R Documentation

Predict Method for bfsl Model Fits

Description

predict.bfsl predicts future values based on the bfsl fit.

Usage

## S3 method for class 'bfsl'
predict(
  object,
  newdata,
  interval = c("none", "confidence"),
  level = 0.95,
  se.fit = FALSE,
  ...
)

Arguments

object

Object of class "bfsl".

newdata

A data frame with variable x to predict. If omitted, the fitted values are used.

interval

Type of interval calculation. "none" or "confidence".

level

Confidence level.

se.fit

A switch indicating if standard errors are returned.

...

Further arguments passed to or from other methods.

Value

predict.bfsl produces a vector of predictions or a matrix of predictions and bounds with column names fit, lwr, and upr if interval is set to "confidence".

If se.fit is TRUE, a list with the following components is returned:

fit Vector or matrix as above
se.fit Standard error of predicted means

Examples

fit = bfsl(pearson_york_data)
predict(fit, interval = "confidence")
new = data.frame(x = seq(0, 8, 0.5))
predict(fit, new, se.fit = TRUE)

pred.clim = predict(fit, new, interval = "confidence")
matplot(new$x, pred.clim, lty = c(1,2,2), type = "l", xlab = "x", ylab = "y")
df = fit$data
points(df$x, df$y)
arrows(df$x, df$y-df$sd_y, df$x, df$y+df$sd_y,
       length = 0.05, angle = 90, code = 3)
arrows(df$x-df$sd_x, df$y, df$x+df$sd_x, df$y,
       length = 0.05, angle = 90, code = 3)


[Package bfsl version 0.2.0 Index]