`textmodel_wordscores`

implements Laver, Benoit and Garry's (2003)
"Wordscores" method for scaling texts on a single dimension, given a set of
anchoring or *reference* texts whose values are set through reference
scores. This scale can be fitted in the linear space (as per LBG 2003) or in
the logit space (as per Beauchamp 2012). Estimates of *virgin* or
unknown texts are obtained using the `predict()`

method to score
documents from a fitted `textmodel_wordscores`

object.

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

The `textmodel_wordscores()`

function and the associated
`predict()`

method are designed
to function in the same manner as `predict.lm`

.
`coef()`

can also be used to extract the word coefficients from the
fitted `textmodel_wordscores`

object, and `summary()`

will print a
nice summary of the fitted object.

## 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`

for methods of applying a
fitted textmodel_wordscores model object to predict quantities from
(other) documents.

## 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

summary(ws)

#> Error in summary(ws): object 'ws' not found

coef(ws)

#> Error in coef(ws): object 'ws' not found

predict(ws)

#> Error in predict(ws): object 'ws' not found

predict(ws, rescaling = "lbg")

#> Error in predict(ws, rescaling = "lbg"): object 'ws' not found

predict(ws, se.fit = TRUE, interval = "confidence", rescaling = "mv")

#> Error in predict(ws, se.fit = TRUE, interval = "confidence", rescaling = "mv"): object 'ws' not found