predict.bfsl: Predict Method for bfsl Model Fits

Description Usage Arguments Value Examples

View source: R/bfsl.R

Description

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

Usage

1
2
3
4
5
6
7
8
9
## 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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)

pasturm/bfsl documentation built on April 15, 2021, 12:15 a.m.