Description Usage Arguments Details Value Examples
Computes a bayesian linear regression fit.
| 1 | 
| formula | an object of class "formula": a symbolic description of the model to be fitted. | 
| prior | the prior distribution, either a  | 
| beta | the precision of the data used for the model. | 
| ... | Additional arguments and values. | 
Models for blm are provided as for lm. If prior
distribution prior of the weights is not provided the prior means 
are set to 0 and the variances to 1.
A object of class blm. An object of class "lm" is a list 
containing at least the following components: 
call: the matched call
formula: the formula used
df.residual: the degrees of freedom of the model
frame: the model frame used
matrix: the model matrix used
beta: the precision of the data
prior: the prior distribution used
posterior: the posterior distribution
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |   w0 <- 0.3 ; w1 <- 1.1 ; b <- 1.3 
  x <- rnorm(50)
  y <- rnorm(50, w1 * x + w0, 1/b) 
  mod <- blm(y~x, data=data.frame(x=x, y=y))
  mod
  plot(mod)
  
  #use with known precision
  mod_det <- blm(y~x, beta=b, data=data.frame(x=x, y=y))
  mod_det
  
  #use of a prior, typically from an existing model 
  x2 <- rnorm(50) 
  y2 <- rnorm(50, w1 * x2 + w0, 1/b) 
  mod2 <- blm(y~x, prior=mod, data=data.frame(x=x2, y=y2)) 
  mod2
  
  #use with 2 explanatory variables 
  w2 <- 3.3 
  z <- rnorm(50) 
  y <- rnorm(50, w2 * z + w1 * x + w0, 1/b) 
  mod <- blm(y~x+z, data=data.frame(x=x, y=y, z=z)) 
  mod
 
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.