pair_contrast | R Documentation |
Construct a sum-to-zero contrast between two logical expressions. This function is particularly useful for comparing specific conditions or combinations of conditions.
pair_contrast(A, B, name, where = NULL)
A |
A formula representing the first logical expression in the contrast. |
B |
A formula representing the second logical expression in the contrast. |
name |
A character string specifying the name of the contrast (mandatory). |
where |
An optional formula specifying the subset over which the contrast is computed. |
The contrast is constructed as (A - B), where A and B are logical expressions that evaluate to TRUE/FALSE for each observation. The resulting contrast weights sum to zero.
A pair_contrast_spec object containing:
A |
First logical expression |
B |
Second logical expression |
where |
Subsetting formula (if provided) |
name |
Contrast name |
pairwise_contrasts
for all pairwise comparisons,
contrast_set
for creating sets of contrasts
# Compare faces vs scenes
pair_contrast(~ category == "face", ~ category == "scene", name = "face_vs_scene")
# Compare with subsetting
pair_contrast(~ category == "face", ~ category == "scene",
name = "face_vs_scene_block1",
where = ~ block == 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.