Predict textmodel_wordscores
# S3 method for textmodel_wordscores
predict(
object,
newdata = NULL,
se.fit = FALSE,
interval = c("none", "confidence"),
level = 0.95,
rescaling = c("none", "lbg", "mv"),
force = TRUE,
...
)
a fitted Wordscores textmodel
dfm on which prediction should be made
if TRUE
, return standard errors as well
type of confidence interval calculation
tolerance/confidence level for intervals
"none"
for "raw" scores; "lbg"
for LBG (2003)
rescaling; or "mv"
for the rescaling proposed by Martin and Vanberg
(2007). See References.
make the feature set of newdata
conform to the model
terms. The default of TRUE
means that a fitted model can be applied
to scale a dfm that does not contain a 1:1 match of features in the
training and prediction data.
not used
predict.textmodel_wordscores()
returns a named vector of predicted
document scores ("text scores" se.fit = TRUE
consisting of the predicted scores ($fit
) and the
associated standard errors ($se.fit
). When interval =
"confidence"
, the predicted values will be a matrix. This behaviour matches
that of predict.lm
.
# NOT RUN {
tmod <- textmodel_wordscores(data_dfm_lbgexample, c(seq(-1.5, 1.5, .75), NA))
predict(tmod)
predict(tmod, rescaling = "mv")
predict(tmod, rescaling = "lbg")
predict(tmod, se.fit = TRUE)
predict(tmod, se.fit = TRUE, interval = "confidence")
predict(tmod, se.fit = TRUE, interval = "confidence", rescaling = "lbg")
# }
Run the code above in your browser using DataLab