R: Plot some effects with loess

plotTopicLoess {stm} | R 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)

[Package stm version 1.3.6 Index]