Skip to content

Commit

Permalink
Update README and vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Claessens authored and Scott Claessens committed Aug 13, 2024
1 parent b0b382d commit 3fe8158
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 59 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ fit <-
)
#> Running MCMC with 4 parallel chains...
#>
#> Chain 4 finished in 1223.3 seconds.
#> Chain 3 finished in 1464.1 seconds.
#> Chain 2 finished in 1510.5 seconds.
#> Chain 1 finished in 1517.7 seconds.
#> Chain 4 finished in 1165.9 seconds.
#> Chain 3 finished in 1551.9 seconds.
#> Chain 2 finished in 1591.5 seconds.
#> Chain 1 finished in 1601.1 seconds.
#>
#> All 4 chains finished successfully.
#> Mean chain execution time: 1428.9 seconds.
#> Total execution time: 1518.0 seconds.
#> Mean chain execution time: 1477.6 seconds.
#> Total execution time: 1601.3 seconds.
#> Warning: 61 of 2000 (3.0%) transitions ended with a divergence.
#> See https://mc-stan.org/misc/warnings for details.
```
Expand Down
100 changes: 49 additions & 51 deletions vignettes/coevolve.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: "Introduction to the coevolve package"
output:
rmarkdown::html_vignette:
toc: true
date: "2024-08-09"
date: "2024-08-13"
author: "Scott Claessens"
vignette: >
%\VignetteIndexEntry{Introduction to the coevolve package}
Expand Down Expand Up @@ -48,8 +48,6 @@ coevolutionary effects between any number of variables and a much wider range of
response distributions, including continuous, binary, ordinal, and count
distributions.

Note that the models in this vignette will take a few hours to fit.

## A working example

To show the model in action, we will use data on political and religious
Expand Down Expand Up @@ -113,14 +111,14 @@ fit1 <-
```
Running MCMC with 4 parallel chains...
Chain 4 finished in 1250.9 seconds.
Chain 3 finished in 1496.0 seconds.
Chain 2 finished in 1540.3 seconds.
Chain 1 finished in 1550.7 seconds.
Chain 4 finished in 1069.2 seconds.
Chain 3 finished in 1282.6 seconds.
Chain 2 finished in 1315.0 seconds.
Chain 1 finished in 1316.4 seconds.
All 4 chains finished successfully.
Mean chain execution time: 1459.5 seconds.
Total execution time: 1550.9 seconds.
Mean chain execution time: 1245.8 seconds.
Total execution time: 1316.6 seconds.
```

The function takes several arguments, including a dataset, a named list of
Expand Down Expand Up @@ -342,14 +340,14 @@ fit2 <-
```
Running MCMC with 4 parallel chains...
Chain 3 finished in 150.8 seconds.
Chain 1 finished in 163.0 seconds.
Chain 2 finished in 166.9 seconds.
Chain 4 finished in 172.2 seconds.
Chain 2 finished in 58.9 seconds.
Chain 4 finished in 63.4 seconds.
Chain 1 finished in 64.2 seconds.
Chain 3 finished in 65.5 seconds.
All 4 chains finished successfully.
Mean chain execution time: 163.2 seconds.
Total execution time: 172.4 seconds.
Mean chain execution time: 63.0 seconds.
Total execution time: 65.7 seconds.
```

``` r
Expand All @@ -365,23 +363,23 @@ Variables: brain_weight = lognormal
Autoregressive selection effects:
Estimate Est.Error 2.5% 97.5% Rhat Bulk_ESS Tail_ESS
brain_weight -0.28 0.26 -0.98 -0.01 1.00 1662 1230
group_size -0.86 0.57 -2.22 -0.06 1.00 1246 1111
brain_weight -0.41 0.39 -1.43 -0.01 1.01 700 399
group_size -0.91 0.61 -2.31 -0.04 1.00 709 379
Cross selection effects:
Estimate Est.Error 2.5% 97.5% Rhat Bulk_ESS Tail_ESS
brain_weight ⟶ group_size 0.54 0.58 -0.61 1.63 1.00 854 1275
group_size ⟶ brain_weight 1.68 0.92 -0.32 3.24 1.00 541 1080
brain_weight ⟶ group_size 0.27 0.81 -1.26 1.87 1.00 1027 1038
group_size ⟶ brain_weight 1.23 1.17 -1.61 3.08 1.01 483 679
Drift scale parameters:
Estimate Est.Error 2.5% 97.5% Rhat Bulk_ESS Tail_ESS
brain_weight 0.55 0.14 0.32 0.86 1.00 614 573
group_size 0.65 0.14 0.44 0.98 1.00 1597 845
brain_weight 0.56 0.15 0.33 0.90 1.01 574 573
group_size 0.97 0.18 0.68 1.40 1.01 1055 645
Continuous time intercept parameters:
Estimate Est.Error 2.5% 97.5% Rhat Bulk_ESS Tail_ESS
brain_weight 0.82 0.87 -0.88 2.54 1.00 1291 1425
group_size 0.54 0.86 -1.18 2.21 1.00 1459 1512
brain_weight 0.21 0.72 -1.20 1.59 1.00 1093 1086
group_size -0.01 0.69 -1.42 1.31 1.00 815 919
```

Notice that the number of observations is still 21 in the summary output,
Expand Down Expand Up @@ -452,14 +450,14 @@ fit3 <-
```
Running MCMC with 4 parallel chains...
Chain 1 finished in 458.8 seconds.
Chain 4 finished in 461.2 seconds.
Chain 2 finished in 462.1 seconds.
Chain 3 finished in 472.9 seconds.
Chain 4 finished in 446.2 seconds.
Chain 2 finished in 453.0 seconds.
Chain 1 finished in 463.0 seconds.
Chain 3 finished in 474.8 seconds.
All 4 chains finished successfully.
Mean chain execution time: 463.8 seconds.
Total execution time: 473.1 seconds.
Mean chain execution time: 459.2 seconds.
Total execution time: 474.9 seconds.
```

``` r
Expand All @@ -475,29 +473,29 @@ Variables: x = normal
Autoregressive selection effects:
Estimate Est.Error 2.5% 97.5% Rhat Bulk_ESS Tail_ESS
x -0.76 0.59 -2.17 -0.03 1.00 4184 3203
y -0.52 0.51 -1.85 -0.01 1.00 4104 3636
x -1.20 0.71 -2.73 -0.09 1.00 3067 1657
y -1.10 0.67 -2.58 -0.08 1.00 2961 1405
Cross selection effects:
Estimate Est.Error 2.5% 97.5% Rhat Bulk_ESS Tail_ESS
x ⟶ y -0.72 1.29 -3.12 1.87 1.00 1194 3599
y ⟶ x -0.40 0.82 -1.89 1.34 1.00 1279 3583
x ⟶ y 0.16 0.97 -1.72 2.10 1.00 4613 3500
y ⟶ x 0.14 0.92 -1.71 1.93 1.00 5069 5347
Drift scale parameters:
Estimate Est.Error 2.5% 97.5% Rhat Bulk_ESS Tail_ESS
x 1.34 0.10 1.15 1.56 1.00 9653 5523
y 6.43 0.36 5.77 7.18 1.00 11545 5430
x 0.27 0.02 0.23 0.31 1.00 6876 4778
y 0.29 0.02 0.25 0.34 1.00 6444 4785
Continuous time intercept parameters:
Estimate Est.Error 2.5% 97.5% Rhat Bulk_ESS Tail_ESS
x -0.44 1.01 -2.42 1.54 1.00 3440 5478
y 0.69 1.02 -1.33 2.64 1.00 10566 5961
x -0.05 0.60 -1.23 1.13 1.00 3015 4642
y 0.02 0.62 -1.25 1.22 1.00 2710 2890
Group-level hyperparameters:
Estimate Est.Error 2.5% 97.5% Rhat Bulk_ESS Tail_ESS
sd(x) 6.55 0.98 4.90 8.63 1.00 878 1844
sd(y) 47.74 3.62 41.00 55.10 1.00 1502 2663
cor(x,y) 0.91 0.06 0.76 0.98 1.01 648 1662
Estimate Est.Error 2.5% 97.5% Rhat Bulk_ESS Tail_ESS
sd(x) 0.95 0.15 0.71 1.27 1.00 1457 3164
sd(y) 0.91 0.14 0.67 1.23 1.00 1612 3013
cor(x,y) 0.92 0.05 0.79 0.98 1.00 2303 3911
```

In the model output, we can see that `coev_fit()` has detected the presence of
Expand All @@ -518,8 +516,8 @@ quantile(dt_xy, c(0.055, 0.945))
```

```
5.5% 94.5%
-19.829244 2.929213
5.5% 94.5%
-2.158264 3.062929
```

``` r
Expand All @@ -529,8 +527,8 @@ quantile(dt_yx, c(0.055, 0.945))
```

```
5.5% 94.5%
-20.868104 6.443599
5.5% 94.5%
-2.601244 3.263719
```

## Controlling for spatial location
Expand Down Expand Up @@ -594,14 +592,14 @@ fit4 <-
```
Running MCMC with 4 parallel chains...
Chain 1 finished in 2228.2 seconds.
Chain 4 finished in 2240.1 seconds.
Chain 3 finished in 2294.8 seconds.
Chain 2 finished in 2571.2 seconds.
Chain 4 finished in 1788.5 seconds.
Chain 1 finished in 1791.0 seconds.
Chain 3 finished in 1829.8 seconds.
Chain 2 finished in 2061.1 seconds.
All 4 chains finished successfully.
Mean chain execution time: 2333.6 seconds.
Total execution time: 2571.4 seconds.
Mean chain execution time: 1867.6 seconds.
Total execution time: 2061.3 seconds.
```

``` r
Expand Down
2 changes: 0 additions & 2 deletions vignettes/coevolve.Rmd.orig
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ coevolutionary effects between any number of variables and a much wider range of
response distributions, including continuous, binary, ordinal, and count
distributions.

Note that the models in this vignette will take a few hours to fit.

## A working example

To show the model in action, we will use data on political and religious
Expand Down
Binary file modified vignettes/primates-delta-theta-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3fe8158

Please sign in to comment.