Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plotTopicLoess

Plot some effects with loess


Description

Plots a loess line of the topic proportions on a covariate inputted by the user. This allows for a more flexible functional form for the relationship.

Usage

plotTopicLoess(
  model,
  topics,
  covariate,
  span = 1.5,
  level = 0.95,
  main = "",
  xlab = "Covariate",
  ylab = "Topic Proportions"
)

Arguments

model

An STM model object

topics

Vector of topic numbers to plot by the covariate. E.g., c(1,2,3) would plot lines for topics 1,2,3.

covariate

Covariate vector by which to plot topic proportions.

span

loess span parameter. See loess

level

Desired coverage for confidence intervals

main

Title of the plot, default is ""

xlab

X-label, default is "Covariate"

ylab

Y-label, default is "Topic Proportions"

Details

This function is considerably less developed than plot.estimateEffect and we recommend using that function with splines and high degrees of freedom where possible. Computes standard errors through the method of composition as in estimateEffect.

See Also

Examples

plotTopicLoess(gadarianFit, topics=1, covariate=gadarian$pid_rep)

stm

Estimation of the Structural Topic Model

v1.3.6
MIT + file LICENSE
Authors
Margaret Roberts [aut], Brandon Stewart [aut, cre], Dustin Tingley [aut], Kenneth Benoit [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.