Bayesian (stable isotope) mixing models: MixSIAR · 2021. 1. 11. · Consumer Source 1 Source 2...

73
Bayesian (stable isotope) mixing models: MixSIAR BRIAN STOCK MAY 22, 2017

Transcript of Bayesian (stable isotope) mixing models: MixSIAR · 2021. 1. 11. · Consumer Source 1 Source 2...

  • Bayesian (stable isotope) mixing models: MixSIARBRIAN STOCK

    MAY 22, 2017

  • Calculate source % to a mixture

    Introduction

  • Calculate prey % to a diet

    Introduction Semmens et al. (2009)

  • Calculate colony % to a bird

    Introduction Bicknell et al. (2014)

  • Calculate soil % to a sediment

    Introduction

  • Scientists use mixing models a lot

    Phillips et al. (2014)

    MixSIRSIAR

    Year

    Introduction

  • Calculate prey % to a diet

    Introduction

  • Deer70%

    Salmon20%

    10%

    Marinemammals

    Introduction

    Calculate prey % to a diet

  • Deer35%

    Salmon45%

    20%

    Marinemammals

    Introduction

    Calculate prey % to a diet

  • −4

    −2

    0

    2

    −11 −9 −7 −5Isotope 2

    Iso

    tope

    1

    n = 1

    Using stable isotope data

    Introduction

  • −4

    −2

    0

    2

    −11 −9 −7 −5Isotope 2

    Iso

    tope

    1

    n = 1

    Using stable isotope data

    Introduction

  • Consumer

    -28 -25-27δ13C

    Source 1 Source 2

    Diet = ?

    How mixing models work

  • Consumer

    -28 -25-27δ13C

    Source 1 Source 2p1 p2

    Consumer = p1*s1 + p2*s2 (p1 + p2 = 1)

    How mixing models work

  • Consumer

    -28 -25-27δ13C

    Source 1 Source 2

    Consumer = 2/3 s1 + 1/3 s2

    How mixing models work

    2/3 1/3

  • Consumer

    Source 1

    Source 2

    Source 3

    p1

    p2

    p3

    δ15N

    -28 -25-27δ13C

    ConsumerC = p1s1C + p2s2C+ p3s3C

    How mixing models work

    p1 + p2 + p3 = 1

    ConsumerN = p1s1N + p2s2N+ p3s3N

  • Consumer

    Source 1

    Source 2

    Source 3

    p1

    p2

    p3

    δ15N

    -28 -25-27δ13C

    How mixing models work

  • Consumer

    Source 1

    Source 2

    Source 3

    p1

    p2

    p3

    δ15N

    Source 4

    p4

    -28 -25-27δ13C

    How mixing models work

  • Consumer

    Source 1

    Source 2

    Source 3

    p1

    p2

    p3

    δ15N

    Source 4

    p4

    p5

    Source 5

    -28 -25-27δ13C

    How mixing models work

  • Consumer

    Source 1

    Source 2

    Source 3

    p1

    p2

    p3

    δ15N

    Source 4

    p4

    p5

    Source 5

    -28 -25-27δ13C

    How mixing models work

    Bayesian mixing model:

  • Consumer

    Source 1

    Source 2

    Source 3

    p1

    p2

    p3

    δ15N

    Source 4

    p4

    p5

    Source 5

    -28 -25-27δ13C

    How mixing models work

    Bayesian mixing model:

  • 1. Account for uncertainty in data (mix, source, TDF)

    2. Solid statistical basis (likelihood)

    3. Include additional info as priors• stomach/fecal contents

    • prey abundance

    Introduction

    Bayesian models are better

  • 1. Account for uncertainty in data (mix, source, TDF)

    2. Solid statistical basis (likelihood)

    3. Include additional info as priors• stomach/fecal contents

    • prey abundance

    Introduction

    Bayesian models are better

    MixSIR 2008

    SIAR 2010

  • 1. Graphical User Interface (GUI)

    Introduction

    MixSIAR adds further improvements

  • 1. Graphical User Interface (GUI)

    2. Covariate effects

    Introduction

    MixSIAR adds further improvements

  • 1. Graphical User Interface (GUI)

    2. Covariate effects

    3. Fit source data within model

    Introduction

    MixSIAR adds further improvements

  • 1. Graphical User Interface (GUI)

    2. Covariate effects

    3. Fit source data within model

    4. Better error structure(s)

    Introduction

    MixSIAR adds further improvements

  • 1. Graphical User Interface (GUI)

    2. Covariate effects

    3. Fit source data within model

    4. Better error structure(s)

    5. Plot/modify your prior

    Introduction

    MixSIAR adds further improvements

  • 1. Covariate effects

    Covariate effects in MixSIAR

    p = [20%, 50%, 20% 10%]No covariate effects…

    Assumes that all consumers have the same diet

    δ13CConsumer

    N(m,var)

  • 1. Covariate effects

    Covariate effects in MixSIAR

    Transform p’s

    Linear regression in ILR-space

  • 1. Covariate effects

    Covariate effects in MixSIAR

    Transform p’s

    Linear regression in ILR-space

    Intercept/mean

    Fixed/random effect

    Continuous effect(“slope”)

  • 1. Covariate effects

    Fixed effects

    δ13CConsumer

    N(m,var)

  • 1. Covariate effects

    Fixed effects

    Simplest = estimate mean for different groups independently

    δ13CConsumer

    N(m3,var3)N(m1,var1) N(m2,var2)

  • 1. Covariate effects

    Random effects

    More complex

    N(mpop,vargroup)

    δ13CConsumer

    mgroup ~ N(mpop,vargroup)

    Xind ~ N(mgroup,varind)

    Need 2+ groups

  • 1. Covariate effects

    (Nested) Random effects: Wolves Ex

    Semmens et al. (2009)

    3 Regions

    8 Packs

    64 Wolves

  • 1. Covariate effects

    (Nested) Random effects: Wolves Ex

    Semmens et al. (2009)

  • 1. Covariate effects

    Continuous effect: Alligator length

    Nifong et al. (2015)

    Marine

    Freshwater

  • 2. Fit source data within model

    Fit source data within model

    Ask me later (>1 way to do this)

    Boring to talk about… but reduces error

  • Previous models unrealistic

    3. Better error structures Stock and Semmens (2016)

    Isotope 1

  • Previous models unrealistic

    Stock and Semmens (2016)3. Better error structures

  • Previous models unrealistic

    Stock and Semmens (2016)

    𝑛 = 1

    3. Better error structures

  • Previous models unrealistic

    Stock and Semmens (2016)

    𝑛 = 1

    3. Better error structures

  • Previous models unrealistic

    Stock and Semmens (2016)

    𝑛 = 1

    3. Better error structures

  • Previous models unrealistic

    Stock and Semmens (2016)

    𝑛 = 1 𝑛 = ∞

    3. Better error structures

  • Previous models unrealistic

    Stock and Semmens (2016)

    𝑛 = 1 𝑛 = ∞

    𝑛 = 3

    3. Better error structures

  • Previous models unrealistic

    Stock and Semmens (2016)

    𝑛 = 1 𝑛 = ∞

    𝑛 = 3Model 3

    Model 2Model 1

    = * εresidModel 1

    3. Better error structures

  • Ecologically meaningful

    1

    εresid∝ consumption

    Stock and Semmens (2016)3. Better error structures

  • Stock and Semmens (2016)

    1

    εresid∝ consumption

    C = 1

    Ecologically meaningful

    3. Better error structures

  • Ecologically meaningful

    1

    εresid∝ consumption

    Stock and Semmens (2016)

    C = 3C = 1

    3. Better error structures

  • Ecologically meaningful

    1

    εresid∝ consumption

    Stock and Semmens (2016)

    C = 3C = 1

    3. Better error structures

  • Ecologically meaningful

    1

    εresid∝ consumption

    Stock and Semmens (2016)

    Oyster Muscle 0.23

    Human Bone 1.78

    Tissue εavg

    3. Better error structures

  • Confounding of εresid

    Depends on:• Inclusion of covariates that explain variability

    • TDF variance (rarely known)

    3. Better error structures

  • Confounding of εresid

    Depends on:• Inclusion of covariates that explain consumer variability

    • TDF variance (rarely known)

    𝜀𝑎𝑣𝑔 = 2.34 𝜀𝑎𝑣𝑔 = 1.38

    3. Better error structures

  • Confounding of εresid

    Depends on:• Inclusion of covariates that explain consumer variability

    • TDF variance (rarely known)

    𝜀𝑎𝑣𝑔 = 2.89 𝜀𝑎𝑣𝑔 = 1.78

    3. Better error structures

  • More accurate

    Stock and Semmens (2016)

    SIAR

    MixSIR

    MixSIAR

    3. Better error structures

  • 4. Effect of priors/ “Bayesian mixing models are biased”

  • 0. What is a prior?

    “From a Bayesian perspective, the principle of unbiasedness is reasonable in the limit of large samples, but otherwise it is potentially misleading.”

    Gelman et al. (1995)

    𝑃𝑟 𝜃 𝑑𝑎𝑡𝑎 ∝ 𝑷𝒓 𝜽 ∗ 𝑃𝑟 𝑑𝑎𝑡𝑎 𝜃

    Posterior Prior Likelihood

  • 1. There is no “uninformative” prior

    −4

    −2

    0

    2

    −11 −9 −7 −5Isotope 2

    Iso

    tope

    1

    n = 1

  • Problem: proportions are not independent!

    −4

    −2

    0

    2

    −11 −9 −7 −5Isotope 2

    Iso

    tope

    1

    n = 1

    1. There is no “uninformative” prior

  • 1. There is no “uninformative” priorProblem: proportions are not independent!

    −4

    −2

    0

    2

    −11 −9 −7 −5Isotope 2

    Iso

    tope

    1

    n = 1

  • 1. There is no “uninformative” prior

  • 1. There is no “uninformative” prior

  • 2. Effect of the “uninformative” prior

    1. How good is your data?

  • 2. Effect of the “uninformative” prior

    1. How good is your data?

  • 2. Effect of the “uninformative” prior

    1. How good is your data? 2. How much data do you have?

    N = 1

  • 3. Constructing informative priors

    α = (1, 1, 1)

    You control the mean proportions AND the variance (“informativeness”)

  • 3. Constructing informative priors

    α = (1, 1, 1)

    α = (10, 10, 10)

    α = (100, 100, 100)

    You control the mean proportions AND the variance (“informativeness”)

  • 3. Constructing informative priors

    30

    8

    25

    You control the mean proportions AND the variance (“informativeness”)

  • 3. Constructing informative priors

    𝜶 = (𝟑𝟎, 𝟖, 𝟐𝟓)

    30

    8

    25

    You control the mean proportions AND the variance (“informativeness”)

  • 3. Constructing informative priors

    You control the mean proportions AND the variance (“informativeness”)

    𝜶 =𝟑 ∗ (𝟑𝟎, 𝟖, 𝟐𝟓)

    𝟔𝟑𝜶 = (𝟑𝟎, 𝟖, 𝟐𝟓)

    30

    8

    25

  • 4. Effect of priors/ “Bayesian mixing models are biased”

    REDUCE THE INFLUENCE OF THE GENERALIST PRIOR:

    1. COLLECT MORE DATA (SOURCE AND CONSUMER)

    2. SPECIFY A NON-GENERALIST PRIOR

  • Great! Where do I get MixSIAR?

    CRAN (few months ago)

    1. Download and install/update R

    2. Download and install JAGS

    3. Open R and run:

    GitHub (latest)

    1. Download and install/update R

    2. Download and install JAGS

    3. Open R and run:

    Wrap-up

  • Great! Where do I get MixSIAR?

    Wrap-up

  • Great! Where do I get MixSIAR?

    Wrap-up