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

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.

Details

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

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.

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

(ws <- textmodel_wordscores(data_dfm_lbgexample, c(seq(-1.5, 1.5, .75), NA)))
#> Error in get(".SigLength", envir = env): object '.SigLength' not found
predict(ws)
#> Error in predict(ws): object 'ws' not found
predict(ws, rescaling = "mv")
#> Error in predict(ws, rescaling = "mv"): object 'ws' not found
predict(ws, rescaling = "lbg")
#> Error in predict(ws, rescaling = "lbg"): object 'ws' not found