Comments (4)
You mean using the plotbounds() method? Did you try converting the MCMCChains.Chains object to a DataFrame, e.g. DataFrame(chns, append_chains=true)
?
If not, can you send me a MWE and I'll take a look. Clearly we're just starting creating a Turing version of StatisticalRethinking.jl.
from statisticalrethinking.jl.
Dear Mr. Goedman,
I was referring indeed to the plotbounds() method. I managed to plot it with the help of the Julia of the Julia community in Slack (you can find the discussion here https://stackoverflow.com/questions/62028147/plotting-credible-intervals-in-julia-from-turing-model/62070008?noredirect=1#comment109792812_62070008). This is the code (I hope it is useful):
weight_s = (d.weight .-mean(d.weight))./std(d.weight)
height = d.height
@model heightmodel(height, weight) = begin
#priors
α ~ Normal(178, 20)´
σ ~ Uniform(0, 50)
β1 ~ LogNormal(0, 1)
β2 ~ Normal(0, 1)
#model
μ = α .+ weight .* β1 + weight.^2 .* β2
# or μ = fheight.(weight, α, β1, β2) if we are defining fheigth anyways
height ~ MvNormal(μ, σ)
end
chns = sample(heightmodel(height, weight_s), NUTS(), 10000)
describe(chns) |> display
res = DataFrame(chns)
fheight(weight, α, β1, β2) = α + weight * β1 + weight^2 * β2
testweights = -2:0.01:2
arr = [fheight.(w, res.α, res.β1, res.β2) for w in testweights]
m = [mean(v) for v in arr]
quantiles = [quantile(v, [0.1, 0.9]) for v in arr]
lower = [q[1] - m for (q, m) in zip(quantiles, m)]
upper = [q[2] - m for (q, m) in zip(quantiles, m)]
plot(testweights, m, ribbon = [lower, upper])
I'm transcribing the book with julia and Turing.jl, albeit slowly; let me know if I can colaborate! I saw this message today (I'm sorry for the delay), I guess I have to activate the notifications in my email.
Kind Regards,
Emiliano Isaza V
from statisticalrethinking.jl.
Emiliano,
I apologize for not responding to your post. I don't understand how I missed your post 10 days ago, but somehow I must have deleted the notification.
I'll go over above code today and see where it differs from plotbounds()
in SR and if it shows ways to improve plotbounds()
.
Best,
Rob
from statisticalrethinking.jl.
Yes, very nice. I have started to use ribbons in other contexts as well but should probably rework this into plotbounds()
. The other part I would like to allow in plotbounds(
) is to pass in a user defined link function like fweight()
in your code above.
Have you looked at @karajan9 's work on TuringModels and SR? Looks really neat!
from statisticalrethinking.jl.
Related Issues (20)
- TagBot trigger issue HOT 78
- Nevermind HOT 2
- Problem with Chains to DataFrame conversion HOT 7
- Function precis() is not robust to missing values HOT 1
- Reexporting of packages HOT 4
- StatisticalRethinking v4 (SR4) HOT 4
- Dependency issue with psisloo function HOT 7
- Switching to ParetoSmooth.jl HOT 1
- Weird dependency error HOT 2
- '.git' folder is bloated with 1 Go of data ! HOT 6
- Citation HOT 2
- trankplots() and precis() function HOT 1
- Typo? HOT 1
- PI doc string needs updating HOT 11
- Tag StatisticalRethinking 2.1.2 HOT 1
- Tag StatisticalRethinking 2.1.3 HOT 5
- New version StatisticalRethinking.jl HOT 20
- StatisticalRethinking.jl v3: Just a set of methods (such as plotcoef, precis, etc.)? HOT 16
- Version 0.9.0 without bounds HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from statisticalrethinking.jl.