njtierney / yahtsee

Yet Another Hierachical Time Series Extension and Expansion
http://yahtsee.njtierney.com/
Other
2 stars 1 forks source link

How to provide tidiers for random effects? #42

Open njtierney opened 3 years ago

njtierney commented 3 years ago

From the example model provided in the data:

> head(hts_example_model$summary.random$who_subregion)
  ID        mean         sd  0.025quant    0.5quant 0.975quant         mode          kld
1 12 0.012912142 0.05146299 -0.07948271 0.008437384  0.1299337 0.0026994280 0.0001480041
2 24 0.010387670 0.05112816 -0.08207698 0.006219957  0.1261551 0.0010180231 0.0001381301
3 36 0.009417737 0.05092936 -0.08287956 0.005362057  0.1245722 0.0003899776 0.0001365578
4 48 0.014682050 0.05072797 -0.07513949 0.009956646  0.1304789 0.0038323358 0.0001631496
5 60 0.023819469 0.05103956 -0.06308354 0.018041471  0.1416818 0.0098733911 0.0002168935
6 72 0.027778883 0.05114382 -0.05769744 0.021536351  0.1462929 0.0123157725 0.0002286246

I'm not sure how to provide tidiers for these - should this be an option in tidy()

e.g.,

tidy(hts_example_model, random_effect = TRUE)

Not sure what the best way to handle this.

njtierney commented 3 years ago

Look into how broom.mixed does this: https://cran.r-project.org/web/packages/broom.mixed/vignettes/broom_mixed_intro.html