• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

StatisticalRethinkingJulia/SR2TuringPluto.jl: StatisticalRethinking notebook pro ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

StatisticalRethinkingJulia/SR2TuringPluto.jl

开源软件地址:

https://github.com/StatisticalRethinkingJulia/SR2TuringPluto.jl

开源编程语言:

Julia 100.0%

开源软件介绍:

Purpose of SR2TuringPluto.jl

As stated many times by the author in his online lectures, StatisticalRethinking is a hands-on course. This project is intended to assist with the hands-on aspect of learning the key ideas in Statistical Rethinking.

SR2TuringPluto is a Julia project that uses Pluto notebooks for this purpose. Max Lapan has a version using Jupyter. Many of the Pluto notebooks have been derived from Max Lapan's work!

This Julia project uses Turing as the underlying mcmc implementation. A companion project ( SR2StanPluto.jl ) uses Stan.

Each notebook demonstrates Julia versions of code snippets and mcmc models contained in the R package "rethinking" associated with the book Statistical Rethinking by Richard McElreath.

Installation

To (locally) reproduce and use this project, do the following:

  1. Download this project from Github and move to the downloaded directory, e.g.:
$ git clone https://github.com/StatisticalRethinkingJulia/SR2TuringPluto.jl SR2TuringPluto
$ cd SR2TuringPluto

If you want a specific tagged version, use:

$ git tag -l # To see available tags, followed by:
$ git checkout tags/<tag_name> # or simply:
$ git checkout v4.5.0

The next step assumes your base Julia setup includes at least Pkg and Pluto.

  1. Start a Pluto notebook server in the Julia REPL:
$ julia

julia> using Pluto
julia> Pluto.run()
  1. A Pluto page should open in a browser.

Usage

Select a notebook in the open a file entry box, e.g. type ./ and step to ./notebooks/Chapter_00.jl.

All "rethinking" data files are stored and maintained in StatisticalRethinking.jl and can be accessed via sr_datadir(...).

This leads to a typical set of opening lines in each notebook:

using Pkg

# Note: Below sequence is important. First activate the project
# followed by `using` or `import` statements. Pretty much all
# scripts use StatisticalRethinking. If mcmc sampling is
# needed, it must be loaded before StatisticalRethinking:

using Turing
# more using lines, e.g.
using CSV, DataFrames, Distributions
using StatisticalRethinking
using StatisticalRethinkingPlots, StatsPlots, Plots

# To access e.g. the Howell1.csv data file:
df = CSV.read(sr_datadir("Howell1.csv"), DataFrame)
df = df[df.age .>= 18, :]

Naming of models and results:

  1. ppl5_1 : Turing model
  2. m5_1t : The instantiated Turing model (includes data)

Chain(s):

  1. chns5_1t : MCMCChains object (4000 samples from 4 chains)

Results as a DataFrame:

  1. prior5_1t_df : Prior samples (DataFrame)
  2. post5_1t_df : Posterior samples (DataFrame)
  3. quap5_1t_df : MAP approximation to posterior samples (DataFrame)
  4. pred5_1t_df : Posterior predictions (DataFrame)

As before, the t at the end of the model number indicates Turing.

Note: Naming is not yet consistent through all notebooks. Work in progress!

Status

SR2TuringPluto.jl is compatible with the 2nd edition of the book.

StructuralCausalModels.jl and ParetoSmoothedImportanceSampling.jl are included as experimental dependencies in the StatisticalRethinking.jl package. Definitely work in progress!

Max Lapan added a package Dagitty.jl which covers options similar as available in StructuralCausalModels.jl. There is also a new package, ParetoSmooth.jl which overlaps with ParetoSmoothedImportanceSampling.jl. As terminology differs from the terminology used in the Statistical Rethinking book, I have not used this package in the notebooks (yet?).

Any feedback is appreciated. Please open an issue.

Acknowledgements

Of course, without the excellent textbook by Richard McElreath, this package would not have been possible. The author has also been supportive of this work and gave permission to use the datasets.

This repository is derived from work by Max Lapan, Karajan, previous and current Stan versions of StatisticalRethinking.jl. It has been improved through comments and suggestions by many other contributors.

Versions

Version 5.0.0 (Under development, will take time)

  1. Complete overhaul. Likely using Makie.jl, Graphs.jl and more.

Version 4.5.0

  1. Adapted Max Lapan's chapters 5 to 14 to an (initial) Pluto format.

Version 4.0.5

  1. Minor updates to chapters 1-5.

Version 4.0.4

  1. Package updates.

Version 4.0.0-4.0.3

  1. Switch to StatisticalRethinking v4.
  2. Switch to notebooks under development by Max Lapan. Notebooks are being converted to Pluto (vs. Jupyter notebooks).

versions 2 & 3

  1. Many additions for 2nd edition of Statistical Rethinking book.
  2. Version 3 uses many ideas proposed in Karajan's scripts

Version 1.0.0 (in preparation, expected late Nov 2020)

  1. Initial version



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap