boot_jaatha | R Documentation |
This function is a helper function for using the boot
function to bootstrap Jaatha estimates. Each bootstap replication requires
a complete jaatha estimation on data simulated with the original parameter
estimates. Therefore, bootstrapping is normally computationally demanding and
should be executed on a computing cluster.
boot_jaatha(results, R, cores_per_run = 1, verbose = TRUE, ...)
results |
The results of an |
R |
The number of bootstrapping replicates that are performed. |
cores_per_run |
The number of cores that are used for each replicate.
This corresponds to the |
verbose |
If TRUE (default), each bootstrap estimation is written as a message. |
... |
Additional arguments that are passed on |
The result of boot
. This object can be used to
estimate standard errors or confidence intervals of the estimates using
the functions available in package boot.
Note that the returned object contains a vector of parameter values t0
that is the result of an additional jaatha run for the original data, whereas
the parametric bootstrap simulations used parameter values that are in the vector
mle
in the returned boot
object.
By default, the function boot.ci
of the boot
package
uses the parameter values t0
as a reference point.
To use the values in mle
instead, overwrite t0
with mle
before
applying the function boot.ci
.
boot
, jaatha
# The original Jaatha anaylsis:
model <- create_jaatha_model(function(x) rpois(10, x),
par_ranges = matrix(c(0.1, 0.1, 10, 10), 2, 2),
sum_stats = list(create_jaatha_stat("sum", sum)))
data <- create_jaatha_data(rpois(10, 9), model)
jaatha_result <- jaatha(model, data, cores = 2)
# Bootstrapping the results using 2 CPU cores on localhost:
library(boot)
library(snow)
cl <- makeSOCKcluster(c("localhost", "localhost"))
jaatha_boot_results <- boot_jaatha(jaatha_result, 50,
cores_per_run = 2,
parallel = "snow",
cl = cl)
stopCluster(cl)
boot.ci(jaatha_boot_results, type = "norm")
jaatha_boot_results$t0 <- jaatha_boot_results$mle
boot.ci(jaatha_boot_results, type = "norm")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.