netfacs_multiple: Applies the 'netfacs' function across multiple levels of the...

View source: R/netfacs_multiple.R

netfacs_multipleR Documentation

Applies the netfacs function across multiple levels of the condition and puts them in a list

Description

Take dataset and report observed and expected likelihood that elements and combinations of elements occur in this dataset, and whether this differs from a null condition. Expected values are based on bootstraps of null distribution, so the values represent distribution of element co-occurrence under null condition. The resulting object is the basis for most other functions in this package.

Usage

netfacs_multiple(
  data,
  condition,
  duration = NULL,
  ran.trials = 1000,
  control = NULL,
  random.level = NULL,
  combination.size = 2,
  tail = "upper.tail",
  use_parallel = TRUE,
  n_cores = 2
)

Arguments

data

A binary matrix with one column per element, and one row per event, consisting of 1 (element was active during that event) and 0 (element was not active).

condition

character vector of same length as 'data' that contains information on the condition each event belongs to, so probabilities can be compared across conditions

duration

A numeric vector that contains information on the duration of each event; if NULL, all events are assumed to have equal duration.

ran.trials

Number of randomisations that will be performed to find the null distribution.

control

A list of vectors that are used as control variables. During bootstraps, the ratio of events in each level will be adapted. So, for example, if in the test distribution, there are three angry participants for each happy participant, the null distribution will maintain that ratio.

random.level

A character vector of the level on which the randomization should take place. If NULL, the randomization takes place on the event level (i.e., every row can either be selected or not); if a vector is provided, the randomization takes place on the levels of that vector rather than individual events.

combination.size

A positive integer, indicating the maximum combination size of element combinations. Higher numbers will increase computation time. Default is 2.

tail

Either 'upper.tail' (proportion of null probabilities that are larger than observed probabilities), or 'lower.tail' (proportion of null probabilities that are smaller than observed probabilities); default is 'upper.tail'.

use_parallel

Logical, indicating whether randomization or bootstrap should be parallelized (default is TRUE)

n_cores

Numeric, indicating the number cores to be used for parallelization. Default is 2.

Value

An object of class netfacs_multiple, which contains the probabilities of observing element combinations in one condition vs. all other conditions, along with other useful information. The resulting object is the basis for most other functions in this package.

See Also

netfacs, netfacs_extract,

Examples

data(emotions_set)
emo.faces <- netfacs_multiple(
  data = emotions_set[[1]],
  condition = emotions_set[[2]]$emotion,
  ran.trials = 10, # only for example
  combination.size = 2
)

netfacs_extract(emo.faces)

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