Description Usage Arguments Details Value Examples
Updates a blm
object, using new data, parameters
or a new model formula.
1 2 3 |
object |
a |
formula |
a formula for the updated object. |
beta |
precision estimate for the updated object. |
prior |
prior distribution of the updated object. |
data |
data of the updated object. |
... |
other arguments. These are passed to blm. |
Updates a blm
object, using features of the input
object, except, if provided otherwise. The prior for the updated object is
typically the posterior distribution of the input object, but can be
specified specifically (as for all other parameters). Importantly, new data
will only be used when specified as named argument.
The function can
also be used to update the model formula, as described for
update
.
A object of class blm
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | w0 <- 0.3 ; w1 <- 1.1 ; b <- 1.3
x <- rnorm(50)
y <- rnorm(50, w1 * x + w0, 1/b)
mod <- blm(y~x, beta=b, data=data.frame(x=x, y=y))
mod
#use of a prior, typically from an existing model
x2 <- rnorm(50)
y2 <- rnorm(50, w1 * x2 + w0, 1/b)
#using posterior of mod as prior
new_mod <- update(mod, data=data.frame(x=x2, y=y2))
new_mod
#using same prior for mod and new model
new_mod2 <- update(mod, prior=mod$prior, data=data.frame(x=x2, y=y2))
new_mod2
#update model formula
new_mod2 <- update(mod, y~x+0, prior=mod$prior,
data=data.frame(x=x2, y=y2))
new_mod2
#also works with standard R formula update semantics
new_mod2 <- update(mod, ~.+0, prior=mod$prior, data=data.frame(x=x2, y=y2))
new_mod2
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.