Learn R Programming

hdtg (version 0.3.3)

getInitialPosition: Get an eligible initial value for a MTN with given mean and truncations

Description

For a given MTN the function returns an initial vector whose elements are one of: (1) middle point of the truncation interval if both lower and upper bounds are finite (2) lower (upper) bound +0.1 (-0.1) if only the lower (upper) bound is finite (3) the corresponding mean value if lower bound = -Inf are upper bound = Inf.

Usage

getInitialPosition(mean, lowerBounds, upperBounds)

Value

an eligible d-dimensional initial vector.

Arguments

mean

a d-dimensional mean vector.

lowerBounds

a d-dimensional vector specifying the lower bounds.

upperBounds

a d-dimensional vector specifying the upper bounds.

See Also

harmonicHMC(), zigzagHMC(), markovianZigzag()

Examples

Run this code
# Example 1: Bounded interval
mean <- c(0, 0)
lower <- c(-1, -2)
upper <- c(1, 2)
getInitialPosition(mean, lower, upper)

# Example 2: Mixed bounds (some finite, some infinite)
mean <- c(0, 0, 0)
lower <- c(-Inf, 0, -1)
upper <- c(Inf, 5, Inf)
getInitialPosition(mean, lower, upper)

# Example 3: All unbounded (returns mean)
mean <- c(1, 2, 3)
lower <- c(-Inf, -Inf, -Inf)
upper <- c(Inf, Inf, Inf)
getInitialPosition(mean, lower, upper)

Run the code above in your browser using DataLab