Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewcparnell committed Apr 22, 2021
2 parents c281275 + 19a6154 commit ee9c69b
Show file tree
Hide file tree
Showing 5 changed files with 289 additions and 3,288 deletions.
16 changes: 16 additions & 0 deletions aj-content/practicals/siber-comparing-populations.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,23 @@ bayes.overlap.G2.G3 <- bayesianOverlap("1.3", "1.4", ellipses.posterior,
n = 360)
print(bayes.overlap.G2.G3)
```

And summarise the credible intervals of the Bayesian overlap output. Note that this code does not work well on the small number of posterior draws we are using for this basic example - for one it returns negative values which is not possible, but is arising as the smoother has not got enough information to stay close to or within the positive number range.

```{r}
# and we can calculate the corresponding credible intervals using
# our code from above again
# call to hdrcde:hdr using lapply()
overlap.credibles <- lapply(
as.data.frame(bayes.overlap.G2.G3),
function(x,...){tmp<-hdrcde::hdr(x)$hdr},
prob = cr.p)
print(overlap.credibles)
```




1,809 changes: 172 additions & 1,637 deletions aj-content/practicals/siber-comparing-populations.nb.html

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions aj-content/practicals/source-aggregation.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ knitr::opts_chunk$set(echo = TRUE)
```

## Create some simulated data for us to work with
This is essentially the example used in Fry, B. 2013. Alternative approaches for solving underdetermined isotope mixing problems. *MEPS*.
This is essentially the example used in Fry, B. 2013. Alternative approaches for solving under-determined isotope mixing problems. *MEPS*.

Here we use the package simmr to explore the two alternatives to aggregating sources in mixing models.
Here we use the package `simmr` to explore the two alternatives to aggregating sources in mixing models.

```{r simulate-data}
library(simmr, quietly = TRUE)
Expand All @@ -38,8 +38,8 @@ S_sds = cbind(c(1,1,1,1), c(1,1,1,1))
# speficy the consumer data at the origin
# Ten consumers for this example around 0 with small sd of error.
consumers <- cbind(dC = rnorm(10, 0, 0.1),
dN = rnorm(10, 0, 0.1) )
consumers <- cbind(dC = rnorm(n = 10, mean = 0, sd = 0.1),
dN = rnorm(n = 10, mean = 0, sd = 0.1) )
# and create the simmr object
# here we have no TDFs or concentration values
Expand Down
1,743 changes: 96 additions & 1,647 deletions aj-content/practicals/source-aggregation.nb.html

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions aj-content/siar-dos-and-donts.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ p <- c(0.2, 0.4, 0.4)
consumer <- p %*% sources
plot(sources[,1], sources[,2], pch = c(15,15,15), col = c(1,6,4),
xlab = "", ylab = "", bty="L", cex = 3, xlim = c(-12,6),
ylim = c(-5, 10))
Expand Down

0 comments on commit ee9c69b

Please sign in to comment.