cross_threshold: Get Thresholds

Description Usage Arguments Value See Also Examples

View source: R/threshold.R

Description

Get Thresholds

Usage

1
cross_threshold(d, group, x, y, quantiles = c(0, 0.9), participant = NULL)

Arguments

d

wide,dataframe containing the

group

name of column (bare only)

x, y

names of column (bare or quoted) in d with which to do the regression

quantiles

threshold to apply.

participant

optional secondary grouping column. Can be used to nest thresholding (e.g., calculate the quantiles within each participant separately)

Value

data frame object with one column for the group, potentially another index column for participant, and a new column called Threshold. The Threshold column is crossed with the original dataset, but for each crossing, members of group are excluded if they do not cross the threshold.

See Also

get_slope(), get_slope_by_group()

Examples

1
2
3
4
5
6
7
8
sub02 |>
  tidyr::pivot_wider(names_from = contrast, values_from = y) |>
  cross_threshold(voxel, low, high)

# can also calculate within groups
sub02 |>
  tidyr::pivot_wider(names_from = contrast, values_from = y) |>
  cross_threshold(c(voxel, run), low, high, participant = sub)

psadil/nmmr documentation built on June 13, 2021, 11:42 a.m.