Computes the mean log odds of the most likely speaker of each text over pairs of the speaker of a text and every other speaker in the stylest_model.

stylest_odds(model, text, speaker, prior = NULL)

Arguments

model

stylest_model object

text

Text vector. May be a corpus_frame object

speaker

Vector of speaker labels. Should be the same length as x

prior

Prior probability of speakers. Uses equal prior if NULL

Value

A S3 stylest_odds object containing: a stylest_model object; vector of mean log odds that each actual speaker (compared with other speakers in the corpus) spoke their corresponding texts in the corpus; vector of SEs of the log odds

Examples

data(novels_excerpts) speaker_mod <- stylest_fit(novels_excerpts$text, novels_excerpts$author) stylest_odds(speaker_mod, novels_excerpts$text, novels_excerpts$author)
#> $model #> A S3 stylest_model object containing: 3 unique authors and 1043 unique terms. #> $log_odds_avg #> [1] 0.3625500 0.3752112 0.3864900 0.4922300 0.3899163 0.3578583 0.4619084 #> [8] 0.4542496 0.3939327 0.3997168 0.4967785 0.4074016 0.4296487 0.4368732 #> [15] 0.5668975 0.4512220 0.5484987 0.3318069 0.3840112 0.3596779 0.3694457 #> #> $log_odds_se #> [1] 0.2006750 0.1876232 0.1968291 0.2461526 0.2011455 0.1845081 0.2311684 #> [8] 0.2428307 0.2003506 0.2045457 0.2489451 0.2043556 0.2214575 0.2390281 #> [15] 0.2835583 0.2357351 0.2749212 0.1666840 0.2020634 0.1803492 0.1891454 #> #> attr(,"class") #> [1] "stylest_odds"