From a5e9505e9c52bcc38ad14b665937d76cc40d0ece Mon Sep 17 00:00:00 2001 From: Daniel Turek Date: Thu, 27 Jun 2024 20:27:22 -0400 Subject: [PATCH] rebuilt package --- nimbleHMC/man/addHMC.Rd | 13 ++++++++----- nimbleHMC/man/sampler_NUTS.Rd | 9 ++++++--- nimbleHMC/man/sampler_NUTS_classic.Rd | 9 ++++++--- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/nimbleHMC/man/addHMC.Rd b/nimbleHMC/man/addHMC.Rd index a77fdd4..c288c7d 100644 --- a/nimbleHMC/man/addHMC.Rd +++ b/nimbleHMC/man/addHMC.Rd @@ -17,7 +17,7 @@ addHMC( \arguments{ \item{conf}{A nimble MCMC configuration object, as returned by `configureMCMC`.} -\item{target}{A character vector of continuous-valued stochastic node names to sample. If this argument contains any discrete-valued nodes, an error is produced and no sampler is added.} +\item{target}{A character vector of continuous-valued stochastic node names to sample. If this argument contains any discrete-valued nodes, an error is produced and no HMC sampler is added. If this argument is omitted, then no HMC sampler is added.} \item{type}{A character string specifying the type of HMC sampler to add, either "NUTS" or "NUTS_classic". See `help(NUTS)` or `help(NUTS_classic)` for details of each sampler. The default sampler type is "NUTS".} @@ -60,11 +60,14 @@ inits <- list(b0 = 1, b1 = 0.1, sigma = 1) Rmodel <- nimbleModel(code, constants, data, inits, buildDerivs = TRUE) -## create MCMC configuration object -conf <- configureMCMC(Rmodel, nodes = NULL) +## create default MCMC configuration object +conf <- configureMCMC(Rmodel) -## add HMC sampler operating on all stochastic model nodes -addHMC(conf) +## remove default samplers operating on b0 and b1 +conf$removeSamplers(c("b0", "b1")) + +## add an HMC sampler operating on b0 and b1 +addHMC(conf, target = c("b0", "b1")) Rmcmc <- buildMCMC(conf) diff --git a/nimbleHMC/man/sampler_NUTS.Rd b/nimbleHMC/man/sampler_NUTS.Rd index 39b7c9b..1a82e1c 100644 --- a/nimbleHMC/man/sampler_NUTS.Rd +++ b/nimbleHMC/man/sampler_NUTS.Rd @@ -63,9 +63,12 @@ code <- nimbleCode({ } }) -N <- 10 -constants <- list(N = N, x = 1:N) -data <- list(y = 1:N) +set.seed(0) +N <- 100 +x <- rnorm(N) +y <- 1 + 0.3*x + rnorm(N) +constants <- list(N = N, x = x) +data <- list(y = y) inits <- list(b0 = 1, b1 = 0.1, sigma = 1) Rmodel <- nimbleModel(code, constants, data, inits, buildDerivs = TRUE) diff --git a/nimbleHMC/man/sampler_NUTS_classic.Rd b/nimbleHMC/man/sampler_NUTS_classic.Rd index 17e720d..faa1200 100644 --- a/nimbleHMC/man/sampler_NUTS_classic.Rd +++ b/nimbleHMC/man/sampler_NUTS_classic.Rd @@ -63,9 +63,12 @@ code <- nimbleCode({ } }) -N <- 10 -constants <- list(N = N, x = 1:N) -data <- list(y = 1:N) +set.seed(0) +N <- 100 +x <- rnorm(N) +y <- 1 + 0.3*x + rnorm(N) +constants <- list(N = N, x = x) +data <- list(y = y) inits <- list(b0 = 1, b1 = 0.1, sigma = 1) Rmodel <- nimbleModel(code, constants, data, inits, buildDerivs = TRUE)