metropolis: Generate independent data from a single binary chain.

Description Usage Arguments Details

Description

metropolis takes a single binary chain of data in the form of an integer vector and generates b new independent chains of data, placing all of them in an integer matrix with the original data in the first row.

Usage

1
metropolis(bin_chain, m, b)

Arguments

bin_chain

A single binary chain of data represented by an integer vector.

m

An integer representing the number of swaps to be attempted.

b

An integer representing the number of new chains of data to be generated.

Details

metropolis works by taking the supplied bin_chain, and attempting m swaps on it, only preforming a swap of elements if doing so maintains the number of transitions between states in the resulting chain. metropolis then takes the resulting chain, and attempts m swaps on it again, then saving the resulting vector in a new row of an output matrix. metropolis does this b times, each time saving the resulting vector. Once all of the new data has been generated, metropolis returns the newly built integer matrix, of which the first row is the original chain of data bin_chain.


cwcartmell/maRkov documentation built on May 14, 2019, 1:37 p.m.