stylest2_predict {stylest2}R Documentation

Predict authorship of texts.

Description

This function generates predicted probabilities of authorship for a set of texts. It takes as an input a document-feature matrix of texts for which authorship is to be predicted, as well as a stylest2 model containing potential authors.

Usage

stylest2_predict(
  dfm,
  model,
  speaker_odds = FALSE,
  term_influence = FALSE,
  prior = NULL
)

Arguments

dfm

a quanteda dfm object. Each row should represent a text whose authorship is to be predicted.

model

A stylest2 model.

speaker_odds

Should the model return log odds of authorship for each text, in addition to posterior probabilities?

term_influence

Should the model return the influence of each term in determining authorship over the prediction set, in addition to returning posterior probabilities?

prior

Prior probability, defaults to NULL.

Value

A list object:

Examples

data(novels_dfm)
mod <- stylest2_fit(novels_dfm)
stylest2_predict(dfm=novels_dfm, model=mod)


[Package stylest2 version 0.1 Index]