StatisticalRethinkingJulia / StatisticalRethinking.jl

Julia package with selected functions in the R package `rethinking`. Used in the SR2... projects.
MIT License
385 stars 32 forks source link

Optimisation of sim_happiness #128

Closed Shmuma closed 2 years ago

Shmuma commented 2 years ago

Wrote documentation for the method + did couple of optimisations of the logic (~100x times faster, btw :)):

goedman commented 2 years ago

Hi Max (@Shmuma),

As you might have noticed I have been making many updates to a new branch, v4, which I plan to release over the next week or so. Version 4.0.0 is breaking in many ways (some changes were in fact suggestions from you).

Important changes:

- Drop the heavy use of @reexport.
- Switch to ParetoSmooth.jl
- Switch to AxisKeys.jl for mcmc chains if Stan(Sample) is used.
- Enable a switch to Makie.jl and AlgebraOfGraphics.jl by moving all graphics to StatisticalRethinkingPlots and StatisticalRethinkingMakie (in the near future).
- Use projects to set up the needed Julia environment to run the examples, e.g. StatisticalRethinkingStan and StatisticalRethinkingTuring.
- Refine 'tailoring' StatisticalRethinking.jl and the graphics packages based on the availability of StanSample, Turing.jl, etc. using Requires.jl.
- Consider switching to Dagitty.jl.

These changes are tricky to apply as e.g. StatisticalRethinkingPlots.jl needs StatisticalRethinking 4.0.0, so this will take about 2 to 3 weeks to test with the Pluto notebooks in the projects (StatisticalRethinkingStan.jl and StatisticalRethinkingTuring.jl). I have not yet compared in detail your Jupyter notebooks with the StatisticalRethinkingTuring.jl's Pluto notebooks, but will do that during these 2 to 3 weeks.

During these weeks it might be better to continue to work with StatisticalRethinking v3.4.6.

Rob

Shmuma commented 2 years ago

Hi Rob!

Thanks for sharing the information! I'll do my best to assist with the improvements, if you have some concrete tasks/ideas, please ping me.

Dagitty.jl at the moment in quite early stage, so far I've implemented only d-separation, implied independence and graph definition, but working on having more functionality in place. The main idea is to reuse as much as possible existing general graph libraries (JuliaGraphs) and cherry-pick the fastest methods from python and R packages available (so far I used NetworkX, https://pgmpy.org/ and https://github.com/ijmbarr/causalgraphicalmodels). I don't see much problems porting existing code from StructuralCausalModels.jl into Dagitty.jl to simplify migration. Let me know if it makes sense.

In terms of plots, I'm havily using StatsPlots.jl, quite happy with it. But I'm currently just on chapter 7, so, future chapters might require something fancy and sophisticated, don't know.