Learn R Programming

quanteda (version 0.9.9-50)

textmodel_wordscores: Wordscores text model

Description

textmodel_wordscores implements Laver, Benoit and Garry's (2003) wordscores method for scaling of a single dimension.

Usage

textmodel_wordscores(x, y, scale = c("linear", "logit"), smooth = 0)

Arguments

x
the dfm on which the model will be trained
y
vector of training scores associated with each document in x
scale
scale on which to score the words; "linear" for classic LBG linear posterior weighted word class differences, or "logit" for log posterior differences
smooth
a smoothing parameter for word counts; defaults to zero for the to match the LBG (2003) method.

Slots

scale
linear or logit, according to the value of scale

Sw
the scores computed for each word in the training set

x
the dfm on which the wordscores model was called

y
the reference scores

call
the function call that fitted the model

method
takes a value of wordscores for this model

Predict Methods

A predict method is also available for a fitted wordscores object, see predict.textmodel_wordscores_fitted.

Details

Fitting a textmodel_wordscores results in an object of class textmodel_wordscores_fitted containing the following slots:

References

Laver, Michael, Kenneth R Benoit, and John Garry. 2003. "Extracting Policy Positions From Political Texts Using Words as Data." American Political Science Review 97(02): 311-31

Beauchamp, N. 2012. "Using Text to Scale Legislatures with Uninformative Voting." New York University Mimeo.

Martin, L W, and G Vanberg. 2007. "A Robust Transformation Procedure for Interpreting Political Text." Political Analysis 16(1): 93-100.

See Also

predict.textmodel_wordscores_fitted

Examples

Run this code
(ws <- textmodel_wordscores(data_dfm_LBGexample, c(seq(-1.5, 1.5, .75), NA)))

predict(ws)
predict(ws, rescaling = "mv")
predict(ws, rescaling = "lbg")

# same as:
(ws2 <- textmodel_wordscores(data_dfm_LBGexample, c(seq(-1.5, 1.5, .75), NA)))
predict(ws2)

Run the code above in your browser using DataLab