Learn R Programming

Claddis (version 0.7.0)

partition_time_bins: Time bin partitioner

Description

Generates all possible contiguous partitions of N time bins.

Usage

partition_time_bins(n_time_bins, partition_sizes_to_include = "all")

Value

Returns a list of lists of vectors ready for use in test_rates.

Arguments

n_time_bins

The number of time bins.

partition_sizes_to_include

Either "all" (the default) or a vector of requested partition sizes.

Author

Graeme T. Lloyd graemetlloyd@gmail.com

Details

This function is designed for use with the test_rates function and generates all possible contiguous partitions of N time bins. This allows use of an information criterion like AIC to pick a "best" partition, weighing fit and partition number simultaneously.

You can also ask for only partitions of a specific number using the partition_sizes_to_include option. For example, partition_sizes_to_include = c(1, 2, 3) will only return partitions of 1, 2, or 3 sets of elements.

Examples

Run this code

# Get all partitions for four time bins:
partition_time_bins(n_time_bins = 4)

# Get all partitions for five time bins of size 2:
partition_time_bins(n_time_bins = 5, partition_sizes_to_include = 2)

Run the code above in your browser using DataLab