sampler_MaxWiK: Function to generate parameters and simulate a model based on...

View source: R/Sampler_iKernel.R

sampler_MaxWiKR Documentation

Function to generate parameters and simulate a model based on MaxWiK algorithm

Description

Function to generate parameters and simulate a model based on MaxWiK algorithm

Usage

sampler_MaxWiK(
  stat.obs,
  stat.sim,
  par.sim,
  model,
  arg0 = list(),
  size = 500,
  psi_t,
  epsilon,
  nmax = 100,
  include_top = FALSE,
  slowly = FALSE,
  rate = 0.2,
  n_simulation_stop = NA,
  check_err = TRUE,
  include_web_rings = TRUE,
  number_of_nodes_in_ring = 2
)

sampler_MaxWiK_parallel(
  stat.obs,
  stat.sim,
  par.sim,
  model,
  arg0 = list(),
  size = 500,
  psi_t,
  epsilon,
  nmax = 100,
  include_top = FALSE,
  slowly = FALSE,
  rate = 0.2,
  n_simulation_stop = NA,
  check_err = TRUE,
  include_web_rings = TRUE,
  number_of_nodes_in_ring = 2,
  cores = 4
)

Arguments

stat.obs

Summary statistics of the observation point

stat.sim

Summary statistics of the simulations (model output)

par.sim

Data frame of parameters of the model

model

Function to get output of simulation during sampling

arg0

List with arguments for a model function, so that arg0 is NOT changed during sampling

size

Number of points in the simulation based on MaxWiK algorithm

psi_t

Vector of psi and t hyperparameters.

epsilon

Criterion to stop simulation when MSE_current - MSE_previous < epsilon

nmax

Maximal number of iterations

include_top

Logical to include top points (network) from spider_web() function to simulate or do not

slowly

Logical for two algorithms: slow and fast seekers in sampling

rate

Rate value in the range [0,1] to define the rate of changing in the original top of sampled points for slow scheme (if slowly = TRUE)

n_simulation_stop

Maximal number of simulations to stop sampling. If n_simulation_stop = NA then there is no restriction (by default)

check_err

Logical parameter to check epsilon or do not

include_web_rings

Logical to include or do not include the cobweb rings to the simulations

number_of_nodes_in_ring

Number of points/nodes between two points in the web ring. By default number_of_nodes_in_ring = 2

cores

Number of cores for parallel calculations of a model (4 by default)

Value

sampler_MaxWiK() returns the list:

  • results: results of all the simulations;

  • best: the best value of parameter;

  • MSE_min: minimum of MSE;

  • number_of_iterations: number of iterations;

  • time: time of sampling in seconds,

  • n_simulations: the total number of simulations.

sampler_MaxWiK_parallel() returns the same output as in sampler_MaxWiK().

Functions

  • sampler_MaxWiK_parallel(): Function to generate parameters and simulate a model based on MaxWiK algorithm

Examples

MaxWiK::MaxWiK_templates(dir = tempdir()) # See the template 'MaxWiK.Sampling.R' 
# and vignettes for usage.
MaxWiK::MaxWiK_templates(dir = tempdir()) # See the template 'MaxWiK.Sampling.R' 
# and vignettes for usage. For parallel implementation 
# change the function 'sampler_MaxWiK()' to 'sampler_MaxWiK_parallel()'.

MaxWiK documentation built on April 3, 2025, 8:47 p.m.