rcppbugs (version 0.1.4.2)

deterministic: create deterministic rcppbugs objects

Description

Deterministic objects determine their values from other nodes in the mcmc model. They have no contribution to the overall likelihood of the model, but are frequently used as hyperparmeters of stochastic objects.

Usage

deterministic(f, ...) linear(X,b) linear.grouped(X,b,group)

Arguments

f
a user provided funtion that updates the value of the variable
X
the data matrix X to be used in estimation
b
the coefficient vector b to be used in estimation
group
an integer vector equal in length to the rows of X indicating the group membership of the corresponding row
...
arguments to function f

Value

an rcppbugs object representing the deterministic object.

Details

The number of arguments must match the arity of function f.

References

https://github.com/armstrtw/CppBugs

See Also

logp,run.model

Examples

Run this code
NR <- 1e2L
NC <- 2L
y <- matrix(rnorm(NR,1),nr=NR,nc=1L)
X <- matrix(nr=NR,nc=NC)

b <- mcmc.normal(rnorm(NC),mu=0,tau=0.0001)
y.hat.user <- deterministic(function(X,b) { X %*% b }, X, b)
y.hat.cpp <- linear(X,b)

Run the code above in your browser using DataLab