ols_bcm_topic | R Documentation |
Bias-corrected multiplicative estimator for topic model regression. This method applies multiplicative bias correction to regressions that include topic proportions as covariates, accounting for estimation uncertainty in the topic model.
ols_bcm_topic(
Y,
Q = NULL,
W,
S,
B,
k,
data = parent.frame(),
intercept = TRUE,
...
)
## Default S3 method:
ols_bcm_topic(
Y,
Q = NULL,
W,
S,
B,
k,
data = parent.frame(),
intercept = TRUE,
...
)
## S3 method for class 'formula'
ols_bcm_topic(
Y,
Q = NULL,
W,
S,
B,
k,
data = parent.frame(),
intercept = TRUE,
...
)
Y |
numeric response vector, or a one-sided formula |
Q |
numeric matrix of additional controls (if Y is numeric) |
W |
numeric matrix of document-term frequencies |
S |
numeric matrix of topic loadings |
B |
numeric matrix of topic-word distributions |
k |
numeric; bias correction parameter |
data |
data frame (if Y is a formula) |
intercept |
logical; if TRUE, includes an intercept term |
... |
additional arguments |
An object of class mlbc_fit
and mlbc_bcm_topic
with:
coef
: bias-corrected coefficient estimates
vcov
: adjusted variance-covariance matrix
# Load topic model dataset
data(topic_model_data)
# Extract components
Y <- topic_model_data$estimation_data$ly
Z <- as.matrix(topic_model_data$covars)
theta_full <- as.matrix(topic_model_data$theta_est_full)
beta_full <- as.matrix(topic_model_data$beta_est_full)
lda_data <- as.matrix(topic_model_data$lda_data)
# Apply multiplicative bias correction
kappa <- mean(1.0 / lda_data[, 1]) * sqrt(nrow(lda_data))
S <- matrix(c(1.0, 0.0), nrow = 1)
fit <- ols_bcm_topic(Y, Z, theta_full, S, beta_full, k = kappa)
summary(fit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.