subset.twDEMCPops: subset twDEMCPops

Description Usage Arguments Details Author(s) See Also Examples

Description

Condenses MCMC results in an twDEMCPops object to the specified cases.

Usage

1
2
3
## S3 method for class 'twDEMCPops'
subset(x, boKeep, ..., iPops = seq_along(x$pops), 
    dropShortPops = FALSE)

Arguments

x

twDEMCPops object

boKeep

either logical vector or numeric vector of indices of cases to keep

...
iPops

integer vector: only these populations are subset, others are kept

dropShortPops

if set to TRUE, pops in iPops with less samples than to what boKeep refers to are dropped

Details

components thin,Y,nGenBurnin are kept, but may be meaningless after subsetting.

The twDEMCPops class

The class twDEMCPops encapsulates the result of a MCMC run of several populations each consisting of different chains. It is described as result value of twDEMCBlockInt.

The chains within each population have the same length. The chains of different populations, however, may have different length.

The chains within one population are not fully independent, because the proposals are based on a common past chain values. In order to combine each population to a single chain, use stackChainsPop.twDEMCPops. In order to make all the chains the same length and create results as arrays across all populations (as class twDEMC), use function concatPops.twDEMCPops.

There are several methods accessing properties of an object of the twDEMCPops class:

  • number of generations: getNGen.twDEMCPops

  • number of samples (only one sample each thinning inteval): getNSamples.twDEMCPops

  • number of chains: getNChains.twDEMCPops

  • number of populations: getNPops.twDEMCPops

  • number of chains per population: getNChainsPop.twDEMCPops

  • number of parameters: getNParms.twDEMCPops

  • thinning interval: res$thin

  • space replicate that the poplation belongs to: getSpacesPop.twDEMCPops

  • number of space replicates: getNSpaces.twDEMCPops

  • number of blocks: getNBlocks.twDEMCPops

  • parameter bounds: getParBoundsPop.twDEMCPops

  • current temperature of streams: getCurrentTemp.twDEMCPops

  • temperatue at aggregated level: getCurrentBaseTemp.twDEMCPops

There are several methods to transform or subset the results of the twDEMCPops class.

  • transforming to array representation across populations of type twDEMC: concatPops.twDEMCPops

  • select sub-populations: subPops.twDEMCPops

  • select subset of cases: subset.twDEMCPops (this function)

  • make populations the same length: squeeze.twDEMCPops

  • stack all the results of all chains to one big matrix: stackChains.twDEMCPops

  • thin all the chains: thin.twDEMCPops

  • combine several twDEMCPops results to a bigger set of populations: combineTwDEMCPops

  • combine populations for subspaces to bigger populations: stackPopsInSpace.twDEMCPops

  • combine MarkovChains of each population of a twDEMC to a single chain: stackChainsPop.twDEMCPops

There are several methods to utilize the functions of the coda package for the the twDEMCPops class.

  • convert an twDEMCPops to a coda mcmc.list as.mcmc.list.twDEMCPops

  • applying a function to all of the chains: mcmcListApply

  • stack all the results of all chains to one big matrix: stackChains.mcmc.list

  • transforming parameters transOrigPopt.mcmc.list

Author(s)

Thomas Wutzler

See Also

twDEMCBlockInt

Examples

1
2
3
4
5
6
7
if( FALSE){
	tmp <- subset(res,1:3)
	str(tmp)
	tmp <- subset(res,1:10)  # should produce an error
	#mtrace(subset.twDEMCPops)
	tmp <- subset(res,1:10,dropShortPops=TRUE)  
} 

twDEMC documentation built on May 2, 2019, 5:38 p.m.