predict.blm: Predict

Description Usage Arguments Value Examples

Description

Predict means and variance of the response variable for a blm object.

Usage

1
2
3
## S3 method for class 'blm'
predict(object, newdata = NULL, se.fit = FALSE,
  interval = "none", level = 0.95, ...)

Arguments

object

a blm object.

newdata

an optional data frame containing variables with which to predict. If missing, values used for fitting will be extracted from the object.

se.fit

report also standard deviation for the predicted values.

interval

Type of interval calculation, currently only none and confidence implemented.

level

confidence level for interval calculation.

...

other arguments (currently ignored).

Value

A vector of predicted fit values. If se.fit = TRUE, a named list containing the fit values under $fit and standard deviations of the fit values under $se.fit. If interval = "confidence", pseudo-confidence interval, ie lower and upper bounds of quantiles of the fit distrib ution are provided at level for the fit values are provided with $fit as data.frame with columns $fit, $lwr, $upr.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
  x <- rnorm(100)
  b <- 1.3
  w0 <- 0.2 ; w1 <- 3
  y <- rnorm(100, mean = w0 + w1 * x, sd = sqrt(1/b))
  model <- blm(y ~ x, prior = NULL, beta = b, data = data.frame(x=x, y=y))
  
  predict(model)
  
  #with standard deviation"of the fit distribution
  predict(model, se.fit=TRUE) 
  
  #with "confidence interval" of the fit values
  predict(model, interval = 'confidence', level = .95) 
  
  #predict for new explanatory values
  x <- rnorm(10) 
  predict(model, data.frame(x=x))

manschmi/blmr documentation built on May 21, 2019, 11:25 a.m.