comboize: combine genetics, isotopes, and habitat raster with exponents...

Description Usage Arguments Examples

View source: R/combine-types.R

Description

This just multiplies the rasters together, each raised to the appropriate exponent, normalizes and returns the result

Usage

1
comboize(Mgen, Miso, Mhab, beta_gen, beta_iso, beta_hab)

Arguments

Mgen

the genetic posteriors rasterStack. Must be a rasterStack

Miso

the isotope posteriors rasterStack.

Mhab

a single layer raster with the habitat suitabiilty measure as a normalized probability surface.

beta_gen

the exponent to raise the habitat raster to

beta_iso

the exponent to raise the isotope raster to

beta_hab

the exponent to raise the genetic raster to

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# first, run through the example for isotope_posterior_probs() to get
# the rasters for two migrant birds. This gives us the list "birds2"
example(isotope_posterior_probs)

# extract the posterior probs rasters from  that output into a raster stack
miso <- lapply(birds2$regular, function(x) x$posterior_probs) %>%
  raster::stack()

# see the names of the birds we are dealing with:
names(miso)

# get the genetic posteriors for those two birds
mig_gen2 <- migrant_wiwa_genetic_posteriors %>%
  dplyr::filter(ID %in% c(names(miso)))

# make genetic posterior rasters for those two birds, make sure they are
# sorted in the same order as miso, and make a raster stack of it
mgen <- genetic_posteriors2rasters(G = mig_gen2, R = genetic_regions)[names(miso)] %>%
  raster::stack()

# make a normalized prior from habitat quality that is zeros everywhere
# outside of the "known" range.
tmp <- wiwa_habitat_unclipped * wiwa_breed
mhab <- tmp / raster::cellStats(tmp, sum)

# combine genetics, isotopes and habitat with exponents of 1 on each
mcombo <- comboize(mgen, miso, mhab, 1, 1, 1)

gaiah documentation built on July 8, 2020, 6:12 p.m.