This function is for internal use only.

check_initial(initial, nchains)

Arguments

initial

Either a vector or matrix,.

nchains

Integer scalar. Number of chains.

Value

A named matrix.

Details

When initial is a vector, the values are recycled to form a matrix of size nchains * length(initial).

Examples

init <- c(.4, .1)
check_initial(init, 1)
#>      par1 par2
#> [1,]  0.4  0.1
check_initial(init, 2)
#> Warning: While using multiple chains, a single initial point has been passed via `initial`: c(0.4, 0.1). The values will be recycled. Ideally you would want to start each chain from different locations.
#>      par1 par2
#> [1,]  0.4  0.1
#> [2,]  0.4  0.1

init <- matrix(1:9, ncol=3)
check_initial(init, 3)
#>      par1 par2 par3
#> [1,]    1    4    7
#> [2,]    2    5    8
#> [3,]    3    6    9

# check_initial(init, 2) # Returns an error