something like this?
n <- 100
x <- rnorm(n)
xx <- rnorm(n)
xx <- rnorm(n)
xxx <- rnorm(n)
y <- rnorm(n)
r <- inla(y ~ 1 + x + xx + xxx,
data = data.frame(y, x, xx, xxx),
family = "stdnormal",
control.compute = list(config = TRUE))
do.sample <- function(n, r, nm) {
s <- inla.posterior.sample(n, r)
ss <- inla.posterior.sample.eval(nm, s)
rownames(ss) <- nm
return (ss)
}
do.sample(5, r, "x")
do.sample(5, r, c("x", "xx"))
do.sample(5, r, c("x", "xx", "xxx"))
> --
> You received this message because you are subscribed to the Google Groups "R-
> inla discussion group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
r-inla-discussion...@googlegroups.com.
> To view this discussion, visit
>
https://groups.google.com/d/msgid/r-inla-discussion-group/83cf474e-7b84-4185-a1f9-b2a93a04a1e2n%40googlegroups.com
> .
--
Håvard Rue
he...@r-inla.org