Analysis, test, and display parameters for the Dimodal package. Modeled on
the par options storage.
Diopt(...)
Diopt.local(...)As described in Details.
access or change or override options
analysis <string>which type of spacing to analyze, one or more of "lp", "diw", and "cpt" (case-insensitive) for using a low-pass filter, interval spacing, or raw spacing and changepoints
data.midq <integer with valid midquantile type>approximation method to convert quantiles or indices to original data, if 0 determines automatically
lp.kernel <string>filter type, one of "kaiser", "triangular" or "bartlett" (synonyms), "hanning", "hamming", "gaussian" or "normal" (synonyms), "blackman" (case-insensitive)
lp.window <fraction between 0 and 1 or positive integer>kernel size, either as fraction of the data or in points
lp.tests <string>tests to run on detected features, one or more of "ht", "pkexcur", "len", and "ftexcur" (case-insensitive)
lp.param <list>list of tag=value pairs of detector or test or acceptance parameters that will be overridden for the low-pass spacing checks
diw.window <fraction or positive integer>interval size, either as a fraction of the data or in points
diw.tests <string>tests to run on detected features, one or more of "pkexcur", "runht", "nrun", "runlen", "ftexcur" (case-insensitive)
diw.param <list>list of tag=value pairs of detector or test or acceptance parameters to override for the interval spacing checks
peak.fht <fraction>minimum peak height as a fraction of the signal's range
peak.frelht <fraction>minimum peak height as a fraction of the average with the adjacent minima
peak.fhttie <fraction>maximum relative difference to treat values around extrema as the same
peak.fhsupp <fraction>fraction of peak height to determine the support range, used for excursion test (ex. 0.5 is the Full Width at Half Maximum, 1.0 extends to the minima)
flat.fripple <fraction>ripple specification as fraction of the signal's range
flat.minlen <positive integer incl. 0>shortest length of flats in data points
flat.fminlen <fraction>shortest length of flats as fraction of the data
flat.noutlier <positive integer incl. 0>number of outliers beyond the ripple allowed between source of flat and each endpoint
flat.distrib <string>null distribution model for length model test, one of "logistic", "weibull", "normal" or "gaussian" (synonyms), or "gumbel" (case-insensitive)
excur.nrep <positive integer>number of trial draws for peak and flat excursion tests
excur.ntop <positive integer incl. 0>number of points at start and end of data to ignore if they are the largest, to avoid adding the large tails of the spacing to the draw pool; can compare the first and last spacings against its standard deviation
excur.seed <positive integer incl. 0>RNG seed for each excursion test, 0 to not set
excur.nrep <positive integer>number of trial draws for run permutation test
excur.seed <positive integer incl. 0>RNG seed for each permutation test, 0 to not set
alpha.ht <fraction>acceptance level of the peak height model test
alpha.pkexcur.lp <fraction>acceptance level of the peak height excursion (bootstrap) test for features found in the low-pass spacing
alpha.pkexcur.diw <fraction>acceptance level of the peak height excursion (bootstrap) test for features found in the interval spacing
alpha.len <fraction>acceptance level of the flat length model test
alpha.ftexcur.lp <fraction>acceptance level of the flat height excursion (bootstrap) test for features found in the low-pass spacing
alpha.ftexcur.diw <fraction>acceptance level of the flat height excursion (bootstrap) test for features found in the interval spacing
alpha.runht <fraction>acceptance level of the runs permutation test
alpha.nrun <fraction>acceptance level of the runs count statistics test
alpha.runlen <fraction>acceptance level of the longest run test
cpt.libs <string>vector of changepoint packages to use (name preceded by +) or ignore (by -)
cpt.maxfncpt <fraction>maximum fraction of data allowed to be changepoints, before ignoring library results
cpt.qvote <pair of fractions>vector of two quantiles specifying range of number of changepoints per library allowed based on counts from all libraries
cpt.fsep <fraction>maximum separation between changepoints as fraction of data to consider as same point
cpt.sep <positive integer>separation in data (number of points) between changepoints before merging or treating library results as one
cpt.libsep <positive integer incl. 0>separation in data (number of points) between changepoints when merging the variants within a library, if zero take union of all points
cpt.timeout <positive value>time-out in seconds per CPT algorithm before abandoning library method, 0 for no limit
track.maxwindow <fraction or positive integer>maximum low-pass or interval window size for Ditrack variations
palette <string>the color palette to use when plotting the spacing or histogram and marking
features, either a name from palette.pals or if starting with the
string "hcl:" from hcl.pals, where the matching of the name follows
the same rules as the palette functions
colID.data <integer 1 t/m 8>index in the palette (of the 8 colors generated) for drawing the data or its spacing
colID.filter <integer 1 t/m 8>index in the palette for drawing the LP or interval spacing
colID.hist <integer 1 t/m 8>index in the palette for drawing the bars in the data histogram
colID.cdf <integer 1 t/m 8>index in the palette for drawing the distribution atop the histogram, and the decile axes to align the spacing index with the data
colID.peak <integer 1 t/m 8>index in the palette when marking the peaks with vertical dashed or dotted lines
colID.flat <integer 1 t/m 8>index in the palette when marking the flats with boxes around the feature
colID.cpt <integer 1 t/m 8>index in the palette when marking the changepoints with ticks along the upper edge of the graph
digits <positive integer incl. 0>number of significant digits to use when printing raw values, if 0 then
use options("digits")
mark.alpha <logical>TRUE to use ANSI escape codes when printing probabilities to compare them against the alpha levels, FALSE to not add any formatting
mark.flat <string>how to indicate flats in a plot, one of "box" or "bar" (case-insensitive)
Diopt provides a global database of options for the Dimodal analysis. The function can be called in five ways:
Diopt()returns the current options set as a list of tag=value pairs
Diopt(NULL)resets all options to the package defaults, returning values before reset
Diopt(tag1=val1, tag2=val2, ...)checks the option values and stores those that are valid, returning in a list the old values of the tags or NULL if a value is rejected
Diopt(list(tag1=val1, tag2=val2, ...))checks the option values and stores those that are valid, returning in a list the old values of the tags or NULL if a value is rejected
Diopt("tag1", "tag2", ...)returns the requested option(s) in a list
The function does sanity checking on the passed values for each option, and
is preferred to directly modifying the elements in the returned list. Like
par, Diopt(Diopt(tag1=val1, tag2=val2)) will restore the
original state.
Diopt.local returns all current values of the options overridden by the
tag=value pairs in the argument, if the values are valid. Like Diopt, the
arguments can be wrapped in an unnamed list. The options stored do not
change; this is for a local, one-off edit to the values. Do not use
Diopt when setting an opt argument for other functions, which expect
the full list of values and not just those changed.
String options are partially matched. Fraction values are between 0 and 1, exclusive.
Dimodal, palette.pals, hcl.pals
## Use the triangular kernel spanning 10% of the data for the
## low-pass analysis. Set the interval to 30 and override the
## ripple spec in the interval spacing but not for the low-pass.
Diopt(lp.kernel='bartlett', lp.window=0.10, diw.window=30, diw.param=list(flat.fripple=0.02))
## Diopt()$lp.kernel also accesses the new value.
Diopt('lp.kernel', 'diw.window')
## Temporarily override the kernel, without changing default.
Diopt.local(list(lp.kernel='Hanning'))$lp.kernel
Diopt()$lp.kernel
## Reset.
Diopt(NULL)
Run the code above in your browser using DataLab