karajan9 / statisticalrethinking Goto Github PK
View Code? Open in Web Editor NEWWorking through Statistical Rethinking by Richard McElreath
License: MIT License
Working through Statistical Rethinking by Richard McElreath
License: MIT License
Might be worth noting that given how we're dealing with normals (linear transform of normals is also normal), another way to get the prior predictive distribution would be:
function sample_h(μ, σ, n=10_000)
sample_μ = rand(μ, n)
sample_σ = rand(σ, n)
ppd = sample_μ + sample_σ.*randn(n)
end
The crucial line is the ppd line; I included the rest because I was worried about making typos if I changed it to your notation/nomenclature.
Hi @karajan9
You are definitely making nice progress with the scripts! And I like how you are approaching/programming it.
Maybe it is time to continue our earlier discussion about packaging all StatisticalRethinking stuff. A suggestion, if I recall the discussion well, would be to store common useful methods in StatisticalRethinking.jl. This package has no notion about Turing, Stan, etc. StatisticalRethinking.jl would would depend on DataFrames, CSV, BSplines, StatsPlots, etc. So it won't be lightweight.
The (your) Turing scripts would go into StatisticalRethinkingTuring.jl, all Stan related stuff would move to StatisticalRethinkingStan.jl. I would be pretty ok if the approaches in StatisticalRethinkingTuring.jl and StatsiticalRethinkingStan.jl are not identical, there are many roads to Rome.
Each of the mcmc-specific packages will also have a src directory, e.g. in Turing's case it would contain your current quap().
The ...Models.jl repositories would just contain the models. Functions like currently in your tools.jl would move to StatisticalRethinking.jl.
Please let me know what you think of such an approach. I also have a question about the current 5.1 spurious_associations script. Which version of DataFrames do you use to allow line 168? I need to update that line as shown below:
julia> a = [1, 2, 3];
julia> b = [6, 7, 8];
julia> df = DataFrame(;a, b)
ERROR: syntax: invalid keyword argument syntax "a"
Stacktrace:
[1] top-level scope at REPL[20]:1
julia> df = DataFrame(;a=a, b=b)
3×2 DataFrame
│ Row │ a │ b │
│ │ Int64 │ Int64 │
├─────┼───────┼───────┤
│ 1 │ 1 │ 6 │
│ 2 │ 2 │ 7 │
│ 3 │ 3 │ 8 │
(StatReth) pkg> st DataFrames
Status `~/Projects/statisticalrethinking/Project.toml`
[a93c6f00] DataFrames v0.21.4
Slowly I'm starting to see the light at the end of the StructuralCausalModels.jl tunnel which I hope to register over the the next couple of weeks. My guess is it will take quite some work to get it to the level of dagitty.net 3.0 but it might be better to publish now and to get feedback and input from others.
Best,
Rob
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.