MyNixOS website logo
Description

A 'Shiny' Application for Inspecting Structural Topic Models.

This app enables interactive validation, interpretation and visualization of structural topic models from the 'stm' package by Roberts and others (2014) <doi:10.1111/ajps.12103>. It also includes helper functions for model diagnostics and extracting data from effect estimates.

stminsights

AppVeyor BuildStatus CRANstatus CRANdownloads

A Shiny Application for Structural Topic Models

This app enables interactive validation, interpretation and visualization of Structural Topic Models (STM). Stminsights is focused on making your life easier after fitting your STM models. In case you are not familiar with the STM package, the corresponding vignette is an excellent starting point.

How to Install

You can download and install the latest development version of stminsights by running devtools::install_github('cschwem2er/stminsights').

For Windows users installing from github requires proper setup of Rtools.

stminsights can also be installed from CRAN by running install.packages('stminsights').

How to Use

After loading stminsights you can launch the shiny app in your browser:

library(stminsights)
run_stminsights()

You can then upload a .RData file which should include:

  • one or several stm objects.
  • one or several estimateEffect objects.
  • an object out which was used to fit your stm models.

As an example, the following code fits two models and estimates effects for the Political Blog Corpus. Afterwards, all objects required for stminsights are stored in stm_poliblog5k.RData.

library(stm)

out <- list(documents = poliblog5k.docs,
            vocab = poliblog5k.voc,
            meta = poliblog5k.meta)

poli <- stm(documents = out$documents, 
            vocab = out$vocab,
            data = out$meta, 
            prevalence = ~ rating * s(day),
            K = 20)
prep_poli <- estimateEffect(1:20 ~ rating * s(day), poli,
                            meta = out$meta)

poli_content <-  stm(documents = out$documents, 
                     vocab = out$vocab,
                     data = out$meta, 
                     prevalence = ~ rating + s(day),
                     content = ~ rating,
                     K = 15)  
prep_poli_content <- estimateEffect(1:15 ~ rating + s(day), poli_content,
                                    meta = out$meta)

save.image('stm_poliblog5k.RData')

After launching stminsights and uploading the file, all objects are automatically imported and you can select which models and effect estimates to analyze.

In addition to the shiny app, several helper functions are available, e.g. get_effects() for storing effect estimates in a tidy dataframe.

How to Deploy on Shiny Server

To deploy stminsights to your own shiny server, place the file app.R, which is located at inst/app of this package, to a folder in your server directory and you should be good to go.

Citation

Please cite stminsights if you use it for your publications:

  Carsten Schwemmer (2021). stminsights: A Shiny Application for Inspecting
  Structural Topic Models. R package version 0.4.1.
  https://github.com/cschwem2er/stminsights

A BibTeX entry for LaTeX users is:

  @Manual{,
    title = {stminsights: A Shiny Application for Inspecting Structural Topic Models},
    author = {Carsten Schwemmer},
    year = {2021},
    note = {R package version 0.4.1},
    url = {https://github.com/cschwem2er/stminsights},
  }
Metadata

Version

0.4.3

License

Unknown

Platforms (77)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows