gibbs_stcos {stcos} | R Documentation |
Gibbs Sampler for STCOS Model
Description
Gibbs Sampler for STCOS Model
Usage
gibbs_stcos(
z,
v,
H,
S,
Kinv,
R,
report_period = R + 1,
burn = 0,
thin = 1,
init = NULL,
fixed = NULL,
hyper = NULL
)
## S3 method for class 'stcos_gibbs'
logLik(object, ...)
## S3 method for class 'stcos_gibbs'
DIC(object, ...)
## S3 method for class 'stcos_gibbs'
print(x, ...)
## S3 method for class 'stcos_gibbs'
fitted(object, H, S, ...)
## S3 method for class 'stcos_gibbs'
predict(object, H, S, ...)
Arguments
z |
Vector which represents the outcome; assumed to be direct estimates from the survey. |
v |
Vector which represents direct variance estimates from the survey. |
H |
Matrix of overlaps between source and fine-level supports. |
S |
Design matrix for basis decomposition. |
Kinv |
The precision matrix |
R |
Number of MCMC reps. |
report_period |
Gibbs sampler will report progress each time this many iterations are completed. |
burn |
Number of the |
thin |
After burn-in period, save one out of every |
init |
A list containing the following initial values for the MCMC:
|
fixed |
A list specifying which parameters to keep fixed in the MCMC.
This can normally be left blank. If elements |
hyper |
A list containing the following hyperparameter values:
|
object |
A result from |
... |
Additional arguments. |
x |
A result from |
Details
Fits the model
using a Gibbs sampler with closed-form draws.
Helper functions produce the following outputs:
-
logLik
computes the log-likelihood for each saved draw. -
DIC
computes the Deviance information criterion for each saved draw. -
print
displays a summary of the draws. -
fitted
computes the meanfor each observation
, for each saved draw.
-
predict
drawsfor each observation
, using the parameter values for each saved Gibbs sampler draw.
Value
gibbs_stcos
returns an stcos
object which contains
draws from the sampler. Helper functions take this object as an input
and produce various outputs (see details).
Examples
## Not run:
demo = prepare_stcos_demo()
out = gibbs_stcos(demo$z, demo$v, demo$H, demo$S, solve(demo$K),
R = 100, burn = 0, thin = 1)
print(out)
logLik(out)
DIC(out)
fitted(out, demo$H, demo$S)
predict(out, demo$H, demo$S)
## End(Not run)