Learn R Programming

quanteda (version 0.9.9-3)

textmodel_wordshoal: wordshoal text model

Description

Estimate Lauderdale and Herzog's (2016) model for one-dimensional document author (eg speakers) positions based on multiple groups of texts (eg debates). Each group of texts is scaled using Slapin and Proksch's (2008) "wordfish" Poisson scaling model of one-dimensional document positions, and then the positions from a particular author are scaled across groups using a second-level linear factor model, using conditional maximum likelihood.

Usage

textmodel_wordshoal(data, groupvar, authorvar, dir = c(1, 2), tol = 0.001)

Arguments

data
the corpus on which the model will be fit
groupvar
the name of a variable in the document variables for data giving the document group for each document
authorvar
the name of a variable in the document variables for data giving the author of each document
dir
set global identification by specifying the indexes for a pair of authors such that $\hat{\theta}_{dir[1]} < \hat{\theta}_{dir[2]}$.
tol
tolerance for convergence. A convergence threshold for the log-posterior of the model.

Value

An object of class textmodel_fitted_wordshoal. This is a list containing: containing:

Details

Returns estimates of relative author positions across the full corpus of texts.

References

Benjamin E Lauderdale and Alexander Herzog. 2016. "A Scaling Model for Estimating Time-Series Party Positions from Texts." Political Analysis.

Examples

Run this code
## Not run: 
# data(ie30corpus, package = "quantedaData")
# wordshoalfit <- 
#     textmodel_wordshoal(ie30corpus, groupvar = "debateID", authorvar = "member.name")
# fitdf <- merge(as.data.frame(summary(wordshoalfit)),
#                docvars(ie30corpus), 
#                by.x="row.names", by.y="member.name")
# fitdf <- subset(fitdf,!duplicated(memberID))
# aggregate(theta ~ party.name, data = fitdf, mean)
# ## End(Not run)

Run the code above in your browser using DataLab