Skip to content

Commit ca48ba4

Browse files
committed
Remove StatisticalRethinking as a dependency.
1 parent debc968 commit ca48ba4

13 files changed

Lines changed: 34 additions & 41 deletions

File tree

Project.toml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,24 @@ authors = ["@alvaro1101, Rob J Goedman <goedman@icloud.com"]
44
version = "0.1.0"
55

66
[deps]
7+
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
8+
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
9+
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
710
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
811
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
12+
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
913
StanSample = "c1514b29-d3a0-5178-b312-660c88baa699"
10-
StatisticalRethinking = "2d09df54-9d0f-5258-8220-54c2a3d4fbee"
1114
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1215
StatsFuns = "4c63d2b9-4356-54db-8cca-17b64c39e42c"
1316
StatsPlots = "f3b207a7-027a-5e70-b257-86293d7955fd"
1417
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1518

1619
[compat]
20+
CSV = "0.8"
21+
DataFrames = "0.22"
22+
Distributions = "0.24"
1723
JSON = "0.21"
1824
StanSample = "3.0"
19-
StatisticalRethinking = "3.2"
2025
StatsFuns = "0.9"
2126
StatsPlots = "0.14"
2227
julia = "1"

examples/arsenic/compare.png

-330 Bytes
Loading

examples/arsenic/cvit.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using Random
2+
13
# CVIT - Create itr and itst indeces for k-fold-cv
24
#
35
# Description

examples/arsenic/demo_wells.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
using StatisticalRethinking
2-
using JSON
3-
using StanSample
41
using ParetoSmoothedImportanceSampling
2+
using StanSample, StatsFuns, StatsPlots
3+
using JSON
54
using Printf
65

76
ProjDir = @__DIR__

examples/cars_waic/cars.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using StatisticalRethinking, StanSample
2-
using ParetoSmoothedImportanceSampling, RDatasets
1+
using ParetoSmoothedImportanceSampling, StanSample
2+
using StatsFuns, RDatasets
33

44
df = RDatasets.dataset("datasets", "cars")
55

@@ -36,8 +36,7 @@ data = (N = size(df, 1), speed = df.Speed, dist = df.Dist)
3636
rc = stan_sample(cars_stan_model; data)
3737

3838
if success(rc)
39-
cars_df = read_samples(cars_stan_model; output_format=:dataframe)
40-
precis(cars_df[:, [:a, :b, :sigma]])
39+
stan_summary(cars_stan_model, true)
4140
nt_cars = read_samples(cars_stan_model);
4241
end
4342

examples/roaches/diag_plot_1.png

277 Bytes
Loading

examples/roaches/diag_plot_2.png

1.32 KB
Loading

examples/roaches/roaches.jl

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using StatisticalRethinking, StanSample
2-
using Printf, ParetoSmoothedImportanceSampling
1+
using ParetoSmoothedImportanceSampling, StanSample
2+
using CSV, Printf, StatsPlots
33

44
ProjDir = @__DIR__
55

@@ -47,8 +47,7 @@ sm1 = SampleModel("roaches1", roaches1_stan; tmpdir)
4747
rc1 = stan_sample(sm1; data)
4848

4949
if success(rc1)
50-
roaches1_df = read_samples(sm1; output_format=:dataframe)
51-
precis(roaches1_df[:, [Symbol("beta.$i") for i in 1:data.K]])
50+
stan_summary(sm1, true)
5251
nt1 = read_samples(sm1)
5352

5453
# Compute LOO and standard error
@@ -129,8 +128,7 @@ sm2 = SampleModel("roaches2", roaches2_stan; tmpdir)
129128
rc2 = stan_sample(sm2; data)
130129

131130
if success(rc2)
132-
roaches2_df = read_samples(sm2; output_format=:dataframe)
133-
precis(roaches2_df[:, [Symbol("beta.$i") for i in 1:data.K]])
131+
read_summary(sm2, true)
134132
nt2 = read_samples(sm2)
135133

136134
# Compute LOO and standard error
@@ -141,14 +139,8 @@ if success(rc2)
141139
@printf(">> elpd_loo = %.1f, SE(elpd_loo) = %.1f\n", elpd_loo2, se_elpd_loo2)
142140

143141
# Check the shape parameter k of the generalized Pareto distribution
144-
if all(pk2 .< 0.5)
145-
println("All Pareto k estimates OK (k < 0.5).")
146-
else
147-
pk_good = sum(pk2 .<= 0.5)
148-
pk_ok = length(pk2[pk2 .<= 0.7]) - pk_good
149-
pk_bad = length(pk2[pk2 .<= 1]) - pk_good - pk_ok
150-
println((good=pk_good, ok=pk_ok, bad=pk_bad, very_bad=sum(pk2 .> 1)))
151-
end
142+
pk_qualify(pk2) |> display
143+
152144
end
153145

154146
begin

notebooks/arsenic.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ using Pkg, DrWatson, ParetoSmoothedImportanceSampling
99

1010
# ╔═╡ d4f7a39c-5ebb-11eb-0a37-4b8499832108
1111
begin
12-
using StatisticalRethinking
12+
using StanSample, StatsFuns, StatsPlots
1313
using JSON
14-
using StanSample
1514

1615
ProjDir = joinpath(psis_path, "..", "examples", "arsenic")
1716
include(joinpath(ProjDir, "cvit.jl"))

notebooks/cars.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ using Pkg, DrWatson, ParetoSmoothedImportanceSampling
99

1010
# ╔═╡ 20d3ad36-6008-11eb-2f2a-d379b234b0e9
1111
begin
12-
using StatisticalRethinking
13-
using StanSample
14-
using RDatasets
12+
using StanSample, StatsFuns, StatsPlots
13+
using DataFrames, RDatasets
1514
end;
1615

1716
# ╔═╡ af6b0b20-6008-11eb-2fa1-2f61145ab7db
@@ -67,7 +66,8 @@ begin
6766

6867
if success(rc)
6968
cars_df = read_samples(cars_stan_model; output_format=:dataframe)
70-
PRECIS(cars_df[:, [:a, :b, :sigma]])
69+
isdefined(Main, :StatisticalRethinking) &&
70+
PRECIS(cars_df[:, [:a, :b, :sigma]])
7171
end
7272
end
7373

0 commit comments

Comments
 (0)