plotTopicLoess: Plot some effects with loess

View source: R/plotTopicLoess.R

plotTopicLoessR Documentation

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

plot.estimateEffect

Examples

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

bstewart/stm documentation built on Jan. 3, 2024, 6:58 p.m.