element_covariate {AnimalSequences} | R Documentation |
Calculate Element-Covariate Conditional Probabilities
Description
This function calculates the conditional probability of each element given each covariate and performs permutation tests to compute the expected conditional probabilities and p-values.
Usage
element_covariate(
sequences_long,
element = "element",
covariate = "covariate",
n_permutations = 1000
)
Arguments
sequences_long |
A data frame containing the sequences, with columns for elements and covariates. |
element |
A string specifying the column name for elements in the sequences data frame. |
covariate |
A string specifying the column name for covariates in the sequences data frame. |
n_permutations |
An integer specifying the number of permutations for the bootstrapping process. |
Value
A data frame with the calculated probabilities, expected probabilities, and p-values for each element-covariate pair.
Examples
# Example usage:
sequences_long <- data.frame(
element = rep(letters[1:3], each = 4),
covariate = rep(letters[4:7], times = 3)
)
result <- element_covariate(sequences_long,
element = 'element',
covariate = 'covariate',
n_permutations = 50)
print(result)
[Package AnimalSequences version 0.2.0 Index]