pick_threshold {swaRmverse}R Documentation

Pick a Threshold for the Events' Definition

Description

An interactive function that calculates and prints the quantiles of the input distribution and asks the user to input the threshold value they want to keep. If a threshold is given as input, then the function checks that the threshold type is correct and returns it. In the swaRmverse framework, the timesteps with lower values than the threshold will be labelled as not part of an event.

Usage

pick_threshold(data_distr, var, threshold = NA)

Arguments

data_distr

A numeric vector to pick a threshold for. In the package's pipeline it is the timeseries of polarization and average speed of a group.

var

A string, the of the distribution to use at the interactive step to ask the user for input.

threshold

If NA (the default), the function runs in interactive mode and the user inputs a given value to return. If numeric, the function just returns this input (interactive case is off).

Value

the selected or input value of the user for the lower threshold, of the variable to be used for the definition of an event.

Author(s)

Marina Papadopoulou m.papadopoulou.rug@gmail.com

See Also

define_events

Examples

d <- rnorm(25, sd = 1)
d_variable_name <- "a variable"
the_threshold <- 0
pick_threshold(d, d_variable_name, threshold = the_threshold)

## If the threshold is not known, run the interactive version
## without giving a threshold as input.

[Package swaRmverse version 0.1.0 Index]