---
title: "WIG Model"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{WIG Model}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

```{r setup}
library(rwig) |> suppressPackageStartupMessages()
```

The Wasserstein Index Generation (WIG) model leverages
the WDL model for topic modeling and generates time series
sentiment index, given that the docs are associated with timestamps.
This was used to automatically reconstruct the Economic Policy Uncertain (EPU)
index.

```{r}
# create a small dataset
wigdf <- data.frame(
  ref_date = as.Date(c("2012-01-01", "2012-02-01")),
  docs = c("this is a sentence", "this is another sentence")
)

wigfit <- wig(wigdf, ref_date, docs, specs = wig_specs(
  wdl_control = list(num_topics = 2),
  word2vec_control = list(min_count = 1)
))
wigfit
```

## See Also

See also `vignette("wdl-model")`, `vignette("specs")`.

## References

Baker, S. R., Bloom, N., & Davis, S. J. (2016).
Measuring economic policy uncertainty.
_The Quarterly Journal of Economics_, 131(4), 1593–1636.
https://doi.org/10.1093/qje/qjw024

Xie, F. (2020). Wasserstein index generation model: Automatic generation of
time-series index with application to economic policy uncertainty.
_Economics Letters_, 186, 108874.
https://doi.org/10.1016/j.econlet.2019.108874
