hanaml.mcmc is a R wrapper for SAP HANA PAL Markov chain Monte Carlo algorithm.

hanaml.mcmc(
  conn,
  distribution,
  location = NULL,
  scale = NULL,
  shape = NULL,
  dof = NULL,
  chain.iter = NULL,
  random.state = NULL,
  init.radius = NULL,
  adapt = NULL,
  warmup = NULL,
  thin = NULL,
  adapt.gamma = NULL,
  adapt.delta = NULL,
  adapt.kappa = NULL,
  adapt.offset = NULL,
  adapt.init.buffer = NULL,
  adapt.term.buffer = NULL,
  adapt.window = NULL,
  stepsize = NULL,
  stepsize.jitter = NULL,
  max.depth = NULL
)

Arguments

conn

ConnectionContext
SAP HANA Database connection object.

distribution

character
Specifies the name of distribution. Valid options include: "normal", "skew.normal", "student.t", "cauchy", "laplace", "logistic", "gumbel", "exponential", "chi.square".
The valid parameters for each distribution are shown as follows:
1. "normal": location, scale.
2. "skew.normal": location, scale, alpha.
3. "student.t": dof, location, scale.
4. "cauchy": location, scale.
5. "laplace": location, scale.
6. "logistic":location, scale.
7. "gumbel": location.
8. "exponential": scale.
9. "chi.square": dof.

location

double, optional
Specifies the location parameter for a distribution. Valid when distribution is set to one of the following values: "normal", "skew.normal", "student.t", "cauchy", "laplace", "logistic".
Defaults to 0.
Deprecated, please use mu.

scale

double, optional(deprecated)
Specifies the scale parameter for a distribution. Valid only when distribution is set to one of the following values: "normal", "skew.normal", "student.t", "cauchy", "laplace", "logistic", "exponential".
Defaults to 1.0.
Deprecated, please use sigma or beta(whichever depends on the type of distributions).

shape

double, optional(deprecated)
Specifies the shape parameter for a distribution. Valid only when distribution is set to "skew.normal".
Defaults to 1.0.

dof

double, optional
Specifies the degree of freedom of a distribution. Valid only when distribution is "student.t" or "chi.square".
Defaults to 1.0.
Deprecated, please use nu.

chain.iter

integer, optional
Specifies number of iterations for each Markov chain including warmup.
Defaults to 2000.

random.state

integer, optional
Specifies the seed used to initialize the random number generator, where 0 means current system time as seed, while other values are simply seed values.
Defaults to 0.

init.radius

double, optional
Specifies the radius to initialize the process.
Defaults to 2.0.

adapt

logical, optional
Specifies whether or not to use adaption.
Defaults to TRUE.

warmup

integer, optional
Specifies the number of warm-up iterations. Defaults to half of chain.iter.

thin

integer, optional
Specifies the period for saving samples.
Defaults to 1.

adapt.gamma

double, optional
Specifies the regularization scale for adaption, must be positive. Invalid when adapt is FALSE.
Defaults to 0.05.

adapt.delta

double, optional
Specifies the target Metropolis acceptance rate, must be restricted between 0 and 1(inclusive of both limits). Only valid when adapt is TRUE.
Defaults to 0.8.

adapt.kappa

double, optional
Specifies the relaxation exponent, must be positive. Only valid when adapt is TRUE.
Defaults to 0.75.

adapt.offset

double, optional
Specifies the adaption iteration offset, must be positive. Only valid when adapt is TRUE.
Defaults to 10.0.

adapt.init.buffer

integer, optional
Specifies the width of initial fast adaption interval. Only valid when adapt is TRUE.
Defaults to 75.

adapt.term.buffer

integer, optional
Specifies the width of terminal(final) fast adaption interval. Only valid when adapt is TRUE.
Defaults to 50.

adapt.window

integer, optional
Specifies the initial width of slow adaption interval. Only valid when adapt is TRUE.
Defaults to 25.

stepsize

double, optional
Specifies the value for discretizing the time interval.
Defaults to 1.0.

stepsize.jitter

double, optional
Specifies the uniform random jitter of step-size.
Defaults to 0.

max.depth

integer, optional
Specifies the maximum tree depth.
Defaults to 10.

Value

DataFrame
Samples of the specified distribution generated from Markov Chain Monte-Carlo process.

Details

Given a distribution, this function generates samples #' of the distribution using Markov chain Monte Carlo simulation.

Examples

The following line of code shows how to generate MCMC samples from student.t distribution with specified distribution parameters:

> res <- hanaml.mcmc(conn, distribution = "student.t",
                     location = 0, dof = 1, chain.iter = 50, thin = 10, init.radius = 0)
> res$Collect()
   ID   SAMPLES
1   0 -1.728452
2   1  1.575337
3   2  1.185957
4   3  4.913828
5   4  0.220282
6   5 -5.588809