PickChains: Draw n other chains and shuffle them

Description Usage Arguments Details Value Examples

View source: R/RcppExports.R

Description

This is part of DE-MCMC algorithm. PickChains draws n chains out of length(chains) chains, excluding the kth chain. GetSubchains is used in migration operator. It draws a subset of chains in nchain chains.

Usage

1
2
3
4
5
PickChains(k, nchain, chains)

GetSubchains(nchain)

SelectEmigrants(ngroup, k)

Arguments

k

the kth processed chain. Must be an integer within the range of 0 to nchain - 1. No check for errorly using R index.

nchain

number of chains to draw.

chains

an integer vector, indicating chain index, e.g., 0:23

ngroup

number of distributed groups

Details

Getsubchains is part of the Migration algroithms. It does two-step shuffling. In step 1, it selects a number l (integer) uniformly between 1 and k to be the number of subpopulations for migration. In step 2, it generates the chain index (0 to nchain - 1) and lastely it shuffles them

Value

a column vector

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
chains <- 0:23

## Presuming current processing chain is the 1st chain (C index = 0)
## pick 2 chains out of 24 chains, excluding current chain.
PickChains(0, 2, chains)

## Example outputs
##      [,1]
## [1,]   17
## [2,]   12
##      [,1]
## [1,]    2
## [2,]    5
##      [,1]
## [1,]    5
## [2,]    3
##      [,1]
## [1,]   10
## [2,]    8
##      [,1]
## [1,]   15
## [2,]    8

## get a random number of subchains
GetSubchains(24)
##       [,1]
##  [1,]    0
##  [2,]    3
##  [3,]    5
##  [4,]    9
##  [5,]   10
##  [6,]   12
##  [7,]   14
##  [8,]   15
##  [9,]   18
## [10,]   20
## [11,]   21
## [12,]   22

ggdmc documentation built on Sept. 2, 2018, 1:03 a.m.