FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

BRMS tutorial: add `rstan` example by falkmielke · Pull Request #346 · inbo/tutorials · GitHub

/ tutorials Public

BRMS tutorial: add rstan example - #346

Merged
falkmielke merged 14 commits into
masterfrom
rstan
Dec 6, 2024
Merged

BRMS tutorial: add rstan example#346
falkmielke merged 14 commits into
masterfrom
rstan

Conversation

falkmielke commented Nov 22, 2024
edited
Loading

Copy link
Copy Markdown
Contributor

Description

This PR adds an example of rstan usage with a raw Stan model to the existing brms tutorial.
I also rearranged that tutorial a bit (separate section for data).

I was able to test the Rmd code, all runs as intended. However, I did not knit or publish any of this to html, the structure and publication procedure of this repo seem too sophisticated for me (though great that it is based on hugo ssg!). I hope it will not crash GHA.

Thank you in advance for review and suggestions!

Task list

  • My tutorial or article is placed in a subfolder of tutorials/content
  • The filename of my tutorial or article is index.md. In case of an Rmarkdown tutorial I have knitted my index.Rmd to index.md (both files are pushed to the repo).
  • I have included tags in the YAML header (see the tags listed in the tutorials website side bar for tags that have been used before)
  • I have added categories to the YAML header and my category tags are from the list of category tags
  • I was not able to compile the tutorial into html files, and would appreciate if you original authors and tutorial maintainers could take over.

wlangera left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Hi Falk

Very nice addition.

I checked the Dutch version. I will assume the same comments apply for the English version.
General remarks:

  • Could you keep the term burnin instead of warmup. I like burnin more.
  • Any particular reason you provide the poisson_model.stan file in brms_eng folder and not in the brms_nl folder?
  • I think I would like to put your section ("Deep Dive: rstan") in a separate section between "Vergelijken met frequentist statistics" and "Referenties". I think the use of rstan is quite advanced for the general users in INBO. Therefore, I think it is better that it is not in the middle of our tutorial, but behind it. People get a view of the whole process of bayesian statistisc (in brms), and if they want (or if they heard about stan somewhere and want to look into it), they can progress further to your section. What do you think?

Het relatieve gebruiksgemak gaat echter ten koste van de flexibiliteit en in zekere mate de leesbaarheid.

Stan en `rstan` daarentegen leunen meer op de wiskundige formulering van modellen.
Elk aspect van het model moet expliciet worden ingesteld, wat een voordeel kan zijn (bijvoorbeeld als u te maken hebt met niet-standaard use cases) of een nadeel (bijvoorbeeld als u modellen op niet-optionele manieren beveiligt).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

wat bedoel je met "een model beveiligen"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This was a translation fault of a faulty English sentence, which on top of that I overlooked in proofreading. My apologies! It is corrected.


Sampling doet vrijwel hetzelfde als hierboven, want in de kern is `brms` gewoon `stan`.

```{r stan_sampling}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Ik zou hier ook zelf een burn-in gebruiken zoals we in de brms-voorbeelden hebben gedaan. Dan is het nog meer gelijkaardig als hierboven.

falkmielke Nov 26, 2024
edited
Loading

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thank you for pointing this out, @wlangera !
I briefly asked @hansvancalster and googled "burn-in tuning warmup Bayesian stats". There is a to-the-point discussion here. My notion of changing came from the fact that we don't physically "burn" or "burn in" anything; thus I was surprised that apparently the term was considered appropriate for some MCMC algorithms. "Tuning", my actual favorite 🤘, is reserved for a certain sub-part of the warm-up phase (Merci, Hans!).

Anyways, the experts seem to prefer "warm-up", and if you agree and confirm, I will in turn adjust this throughout the tutorial.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Ok that sounds good. Thanks

Copy link
Copy Markdown
Contributor

From looking at the content/tutorials/r_brms/index.md file, I think that the html's should be rendered locally and commited to the repo in this folder.

falkmielke and others added 5 commits November 26, 2024 07:31
Co-authored-by: Ward Langeraert <60934857+wlangera@users.noreply.github.com>
Co-authored-by: Ward Langeraert <60934857+wlangera@users.noreply.github.com>
Co-authored-by: Ward Langeraert <60934857+wlangera@users.noreply.github.com>
Co-authored-by: Ward Langeraert <60934857+wlangera@users.noreply.github.com>
Co-authored-by: Ward Langeraert <60934857+wlangera@users.noreply.github.com>

Copy link
Copy Markdown
Contributor Author

From looking at the content/tutorials/r_brms/index.md file, I think that the html's should be rendered locally and commited to the repo in this folder.

Thanks, I will try that, and we see where checks lead us.

Copy link
Copy Markdown
Contributor Author
  • Any particular reason you provide the poisson_model.stan file in brms_eng folder and not in the brms_nl folder?

Good point; I was thinking about git / data redundancy.
Thinking one step further:

  • should they rather be in the [...]/html folder, close to what people actually read?
  • ... or shouldn't they best be in a top level /data folder, or in /inst, to be generally accessible?
    Thank you for advice @wlangera @hansvancalster ! I will move the file and adjust links.

Copy link
Copy Markdown
Contributor
  • Any particular reason you provide the poisson_model.stan file in brms_eng folder and not in the brms_nl folder?

Good point; I was thinking about git / data redundancy. Thinking one step further:

  • should they rather be in the [...]/html folder, close to what people actually read?
  • ... or shouldn't they best be in a top level /data folder, or in /inst, to be generally accessible?
    Thank you for advice @wlangera @hansvancalster ! I will move the file and adjust links.

I would put it in the base folder of your tutorial: content/tutorials/r_brms/ or equally fine in a subfolder of that: content/tutorials/r_brms/<subfolder>. The name for the <subfolder> perhaps model, model_files, stan, stan_files or ...?

Copy link
Copy Markdown
Contributor Author

I incorporated the change suggestions and re-knitted the html reports. This also yielded two image-related issues, here and here.

  • the cmdstanr package is explicitly mentioned (suggestion by @hansvancalster )
  • general code files are now in a general folder
  • knit with low res images

Thank you for re-checking and publishing!

wlangera left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Hi Falk, I have send you the images via mail.

Thanks for the changes

falkmielke merged commit 8c46fb7 into master Dec 6, 2024
falkmielke deleted the rstan branch December 6, 2024 10:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL