specificity: Specificity

View source: R/specificity.R

specificityR Documentation

Specificity

Description

Calculate specificity of element combinations to a given condition

Usage

specificity(
  x,
  condition,
  test.condition = NULL,
  null.condition = NULL,
  combination.size = NULL,
  upsample = TRUE
)

Arguments

x

A binary matrix, with AUs as colnames, or an object of class netfacs

condition

A character condition vector

test.condition

A string, denoting the test condition. If NULL (default) specificity is calculated for all conditions.

null.condition

A string, denoting the null condition. If NULL (default) all observations not part of the test.condition will be considered part of the null.

combination.size

A positive integer, indicating the maximum combination size of element combinations. If NULL (default), the maximum combination size observed in the x is used.

upsample

Logical. Should minority condition(s) be upsampled? TRUE by default.

Details

Specificity values are biased when the number of observations per condition is highly imbalanced. When upsample = TRUE (recommended), the condition(s) with fewer observations are randomly upsampled to match the number of observations in the most common condition prior to the specificity calculation. This procedure minimizes the bias in the specificity results.

Value

A data frame

Examples

specificity(
  x = emotions_set[[1]],
  condition = emotions_set[[2]]$emotion,
  test.condition = "anger"
)

NetFACS documentation built on Dec. 7, 2022, 1:12 a.m.