ar_compare_embeddings
compares embeddings between groups using representational similarity analysis
Usage
ar_compare_embeddings(
associations,
participant_vars,
type = "triangle",
intersection = "pair",
...
)
Arguments
- associations
an
associatoR
object including target_embeddings.- participant_vars
one or more column names specifying the grouping variables for embedding comparisons.
- type
a
character
specifying whether to compute representational similarity based on the full"triangle"
or"row"
-wise. Default is"triangle"
.- intersection
a
character
specifying whether to compute representations for the set of targets shared by all groups ("all"
) or only by the individual pair ("pair"
). The default is ("pair"
).- ...
arguments passed on to
ar_embed_targets
. If no arguments are specified arguments are taken from an existingtarget_embedding
or based on default values.
Details
Representational similarity is calculated based on the Spearman correlation between cosine similarity matrices extracted from each embedding specified by one or more grouping factors.
Examples
ar_obj = ar_import(intelligence,
participant = participant_id,
cue = cue,
response = response,
participant_vars = c(gender, education),
response_vars = c(response_position, response_level)) %>%
ar_set_targets(targets = "cues") %>%
ar_embed_targets()
#> 456 targets with count < min_count were dropped from embedding.
ar_compare_embeddings(ar_obj, gender)
#> # A tibble: 1 × 6
#> group_i group_j targets_i targets_j targets_shared similarity
#> <chr> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 male female 166 213 107 0.207