stm Structural Topic Model - estimateEffect returns only 10 years

41 views Asked by At

I ran an stm topic model and used estimateEffect:

prep <- estimateEffect(1:20 ~ Party + s(Year), model,
                         meta = out$meta, uncertainty = "Global")

What is shown in the console are coefficients for all but one parties (Party) that appear in my metadata, and only 10 (out of 49) years (Year).

Below is the result for one topic.

How can I get all years displayed? I tried tidy(prep) of the tidytext package, without success.

1

There are 1 answers

1
Tetro On

I would say that the 10 values returned by estimateEffect() are the result of the b-spline basis function generated by the s() function on Year covariate.

My guess is that the spline transformation must split the Year values by deciles for fitting non-linear relations between topics and the covariate. But it should be confirmed by more research or an answer by someone more skilled on this issue.