| Title: | Stratigraphic Paleobiology Modeling Pipelines |
|---|---|
| Description: | The fossil record is a joint expression of ecological, taphonomic, evolutionary, and stratigraphic processes (Holland and Patzkowsky, 2012, ISBN:978-0226649382). This package allowing to simulate biological processes in the time domain (e.g., trait evolution, fossil abundance, phylogenetic trees), and examine how their expression in the rock record (stratigraphic domain) is influenced based on age-depth models, ecological niche models, and taphonomic effects. Functions simulating common processes used in modeling trait evolution, biostratigraphy or event type data such as first/last occurrences are provided and can be used standalone or as part of a pipeline. The package comes with example data sets and tutorials in several vignettes, which can be used as a template to set up one's own simulation. |
| Authors: | Niklas Hohmann [aut, cre] (ORCID: <https://orcid.org/0000-0003-1559-1838>) |
| Maintainer: | Niklas Hohmann <[email protected]> |
| License: | Apache License (>= 2) |
| Version: | 0.7.1 |
| Built: | 2026-05-28 07:41:41 UTC |
| Source: | https://github.com/mindthegap-erc/stratpal |
Models perfect taphonomic conditions. Mainly used as default input to last_occ and range_offset or passed as pres_potential argument to apply_taphonomy.
all_preserved(x)all_preserved(x)
x |
taphonomic conditions at which the preservation probability is evaluated |
A vector of the same length as x with all entries replaced by 1.
last_occ(), range_offset(), perfect_preservation(), and apply_taphonomy()
x = p3(rate = 10, 0, 1) # model fossils y = apply_taphonomy(x, pres_potential = all_preserved, ctc = perfect_preservation) all(x == y) # true, all fossils are preservedx = p3(rate = 10, 0, 1) # model fossils y = apply_taphonomy(x, pres_potential = all_preserved, ctc = perfect_preservation) all(x == y) # true, all fossils are preserved
Models niches by removing events (fossil occurrences) or specimens when they are outside of their niche. For event type data, this is done using the function thin, for pre_paleoTS this is done by applying the function prob_remove on the specimens. For fossils objects produced by the FossilSim package, fossil observations are removed according to the specified niche
Combines the functions niche_def and gc ("gradient change") to determine how the taxons' collection probability changes with time/position. This is done by composing niche_def and gc. The result is then used to remove events/specimens in x.
apply_niche(x, niche_def, gc)apply_niche(x, niche_def, gc)
x |
events type data, e.g. vector of times/ages of fossil occurrences or their stratigraphic position, or a |
niche_def |
function, specifying the niche along a gradient. Should return 0 when taxon is outside of niche, and 1 when inside niche. Values between 0 and 1 are interpreted as collection probabilities. Must be vectorized, meaning if given a vector, it must return a vector of equal length. |
gc |
function, stands for "gradient change". Specifies how the gradient changes, e.g. with time. Must be vectorized, meaning if given a vector, it must return a vector of equal length. |
for a numeric vector input, returns a numeric vector, timing/location of events (e.g. fossil ages/locations) preserved after the niche model is applied. For a pre_paleoTS object as input, returns a pre_paleoTS object with specimens removed according to the niche model. For a fossils object, returns a fossils object with some occurrences removed according to the niche definition
snd_niche() and bounded_niche() for template niche models, discrete_niche() and discrete_gradient() to construct niches from discrete categories, trivial_niche() to model organisms without niche specifications
vignette("advanced_functionality) for how to create user-defined niche models
apply_taphonomy() to model taphonomic effects based on a similar principle
thin() and prob_remove() for the underlying mathematical procedures
### example for event type data ## setup # using water depth as gradient t = scenarioA$t_myr wd = scenarioA$wd_m[,"8km"] gc = approxfun(t, wd) plot(t, gc(t), type = "l", xlab = "Time", ylab = "water depth [m]", main = "gradient change with time") # define niche # preferred wd 10 m, tolerant to intermediate wd changes (standard deviation 10 m), non-terrestrial niche_def = snd_niche(opt = 10, tol = 10, cutoff_val = 0) plot(seq(-1, 50, by = 0.5), niche_def(seq(-1, 50, by = 0.5)), type = "l", xlab = "water depth", ylab = "collection probability", main = "Niche def") # niche pref with time plot(t, niche_def(gc(t)), type = "l", xlab = "time", ylab = "collection probability", main = "collection probability with time") ## simulate fossil occurrences foss_occ = p3(rate = 100, from = 0, to = max(t)) # foss occ without niche pref hist(foss_occ, xlab = "time") foss_occ_niche = apply_niche(foss_occ, niche_def, gc) # fossil occurrences with niche preference hist(foss_occ_niche, xlab = "time") # see also #vignette("event_data") # for a detailed example on niche modeling for event type data ### example for pre_paleoTS objects # we reuse the niche definition and gradient change from above! x = stasis_sl(seq(0, max(t), length.out = 10)) plot(reduce_to_paleoTS(x), main = "Trait evolution before niche modeling") y = apply_niche(x, niche_def, gc) plot(reduce_to_paleoTS(y), main = "Trait evolution after niche modeling", ylim = c(-2, 2)) # note that there are fewer sampling sites # bc the taxon does not appear everywhere # and there are fewer specimens per sampling site ### example for fossils objects # we reuse the niche definition and gradient change from above # simulate tree tree = ape::rlineage(birth = 2, death = 0, Tmax = 2) # create fossils object f = FossilSim::sim.fossils.poisson(rate = 2, tree = tree) # plot fossils along tree before niche model is applied FossilSim:::plot.fossils(f, tree = tree) # introduce niche model f_mod = f |> admtools::rev_dir(ref = max(t)) |> # reverse direction bc FossilSim uses age not time apply_niche(niche_def, gc) |> admtools::rev_dir(ref = max(t)) # plot fossils along tree after introduction of niche model FossilSim:::plot.fossils(f_mod, tree = tree) # note how only fossils in the interval where environmental conditions are suitable are preserved # note that FossilSim uses age before the present, which is why we use admtools::rev_dir### example for event type data ## setup # using water depth as gradient t = scenarioA$t_myr wd = scenarioA$wd_m[,"8km"] gc = approxfun(t, wd) plot(t, gc(t), type = "l", xlab = "Time", ylab = "water depth [m]", main = "gradient change with time") # define niche # preferred wd 10 m, tolerant to intermediate wd changes (standard deviation 10 m), non-terrestrial niche_def = snd_niche(opt = 10, tol = 10, cutoff_val = 0) plot(seq(-1, 50, by = 0.5), niche_def(seq(-1, 50, by = 0.5)), type = "l", xlab = "water depth", ylab = "collection probability", main = "Niche def") # niche pref with time plot(t, niche_def(gc(t)), type = "l", xlab = "time", ylab = "collection probability", main = "collection probability with time") ## simulate fossil occurrences foss_occ = p3(rate = 100, from = 0, to = max(t)) # foss occ without niche pref hist(foss_occ, xlab = "time") foss_occ_niche = apply_niche(foss_occ, niche_def, gc) # fossil occurrences with niche preference hist(foss_occ_niche, xlab = "time") # see also #vignette("event_data") # for a detailed example on niche modeling for event type data ### example for pre_paleoTS objects # we reuse the niche definition and gradient change from above! x = stasis_sl(seq(0, max(t), length.out = 10)) plot(reduce_to_paleoTS(x), main = "Trait evolution before niche modeling") y = apply_niche(x, niche_def, gc) plot(reduce_to_paleoTS(y), main = "Trait evolution after niche modeling", ylim = c(-2, 2)) # note that there are fewer sampling sites # bc the taxon does not appear everywhere # and there are fewer specimens per sampling site ### example for fossils objects # we reuse the niche definition and gradient change from above # simulate tree tree = ape::rlineage(birth = 2, death = 0, Tmax = 2) # create fossils object f = FossilSim::sim.fossils.poisson(rate = 2, tree = tree) # plot fossils along tree before niche model is applied FossilSim:::plot.fossils(f, tree = tree) # introduce niche model f_mod = f |> admtools::rev_dir(ref = max(t)) |> # reverse direction bc FossilSim uses age not time apply_niche(niche_def, gc) |> admtools::rev_dir(ref = max(t)) # plot fossils along tree after introduction of niche model FossilSim:::plot.fossils(f_mod, tree = tree) # note how only fossils in the interval where environmental conditions are suitable are preserved # note that FossilSim uses age before the present, which is why we use admtools::rev_dir
Models taphonomy by combining the change in taphonomic conditions with the preservation potential as a function of taphonomic conditions to determine how preservation potential changes. This is then used to systematically remove (thin) the event data using thin/ remove specimens from the pre_paleoTS object using prob_remove.
apply_taphonomy(x, pres_potential, ctc)apply_taphonomy(x, pres_potential, ctc)
x |
event type data, e.g. times/ages of fossil occurrences or their stratigraphic position, or a |
pres_potential |
function. Takes taphonomic conditions as input and returns the preservation potential (a number between 0 and 1). Must be vectorized, meaning if given a vector, it must return a vector of equal length. |
ctc |
function, change in taphonomic conditions (ctc) with time or stratigraphic position. . Must be vectorized, meaning if given a vector, it must return a vector of equal length. |
if given event type data, a numeric vector, location/timing of events (e.g. fossil occurrences) after the taphonomic filter is applied. If given a pre_paleoTS object, returns another pre_paleoTS object with reduced number of specimens. If given a fossils object as created by the FossilSim package, returns another fossils object with some occurrences removed according to preservation potential.
apply_niche() for modeling niche preferences based on the same principle. Internally, these functions are structured identically.
thin() and prob_remove() for the underlying mathematical procedures.
perfect_preservation() and all_preserved() to model perfect preservation of fossils
strat_filter() for simple stratigraphic filtering in the time domain as taphonomic effect
as_char_mat() to construct character matrices associated with stratigraphic information
# see #vignette("advanced_functionality") # for details on usage # or the documentation of apply_ecology for equivalent application to ecology# see #vignette("advanced_functionality") # for details on usage # or the documentation of apply_ecology for equivalent application to ecology
constructor for character matrices for stratigraphic transformations & taphonomic effects
as_char_mat(mat, pos = NULL)as_char_mat(mat, pos = NULL)
mat |
matrix containing the characters, where rows correspond to taxa and columns correspond to the characters. Must have column names with taxon names |
pos |
named vector, with names matching the taxon names of the matrix. Provides the position (time/height) of the taxa in the character matrix |
a object of S3 class char_mat, describing a character matrix with associated positions (times/heights) where the taxa were found
Defines a simple niche model where the niche defined is given by a lower limit (g_min) and an upper limit (g_max) of a gradient the taxon can tolerate
bounded_niche(g_min, g_max)bounded_niche(g_min, g_max)
g_min |
lowest value of the gradient the taxon can tolerate |
g_max |
highest value of the gradient the taxon can tolerate |
a function describing the niche for usage with apply_niche. The function returns 1 if the taxon is within its niche (the gradient is between g_min and g_max), and 0 otherwise
snd_niche() for an alternative niche model
discrete_niche() for defining niches based on discrete categories
trivial_niche() to model organisms without niche specifications
apply_niche() for the function that uses the function returned
vignette("advanced_functionality") for details how to create user-defined niche models
x = seq(0, 10, by = 0.2) f = bounded_niche(2,5) plot(x, f(x), type = "l", xlab = "Gradient", ylab = "Observation probability", main = "Observation probability of taxon") # see also #vignette("event_data") # for details how to use this functionalityx = seq(0, 10, by = 0.2) f = bounded_niche(2,5) plot(x, f(x), type = "l", xlab = "Gradient", ylab = "Observation probability", main = "Observation probability of taxon") # see also #vignette("event_data") # for details how to use this functionality
Constructs a discretized gradient along time/height. The gradient value between
bounds[i] and bounds[i+1] (not including) is vals[i], values above/below the largest/smallest value of bounds are assigned outval.
Helper function for usage with discrete_niche
discrete_gradient(vals, bounds, outval = "")discrete_gradient(vals, bounds, outval = "")
vals |
vector, values of the gradient |
bounds |
vector of strictly increasing values, e.g. times or stratigraphic heights. |
outval |
value, gradient value assigned outside of values covered by |
a functions assigning continuous values (e.g., times or heights) discrete niches
discrete_niche() to construct niches based on discretized gradients
apply_niche() to combine discrete_niche() and discrete_gradient() to model the effects of niches
vignette("advanced_functionality") for details how to create user-defined niche models
# see examples in `discrete_niche` for a use case # and examples in `apply_niche` for the general application to different data types # or the vignette on event data for more context# see examples in `discrete_niche` for a use case # and examples in `apply_niche` for the general application to different data types # or the vignette on event data for more context
Defines a niche model where the gradient based on discrete bins (given by binS)
discrete_niche(bins, rec_prob, outval = 0)discrete_niche(bins, rec_prob, outval = 0)
bins |
vector, bins on which the niche is defined. Can e.g., be numeric or character |
rec_prob |
numeric vector, recovery probability for the bins. Must contain values between 0 and 1 |
outval |
recovery probability for values not in |
a function describing the niche for usage with apply_niche. The function takes (vectors of ) values from bin as input and returns recovery probability for this bin.
discrete_gradient() to construct gradients based on discrete categories.
snd_niche() to define niches along a continuous gradient based on a scaled normal distribution
bounded_niche() to define niches along a continuous gradient based on hard boundaries
apply_niche() for the function used to apply niches to time series or events
vignette("advanced_functionality") for details on how to create user-defined niche models
# example workflow of how to construct discrete niches. For details on #how this can be used in conjunction with apply_niche, see documentation #therein of the vignette on event data # we model a simple niche, separated into "shallow water" and "deep water" bins = c("shallow water", "deep water") # taxon is more abundant in shallow water rec_prob = c(0.9, 0.1) # 90 % recovery probability in shallow water, 10 % in deep water niche = discrete_niche(bins = bins, rec_prob = rec_prob) # lets assume for the first 1 Myr, water is shallow, followed by 0.8 Myr of deep water, # and then 1 Myr of shallow water again # define discretized gradient using discrete_gradient gradient = discrete_gradient(vals = c("shallow water", "deep water", "shallow water"), bounds = c(0,1,1.8,2.8)) # assuming constant fossil abundance before ecological effects, how many fossils do we recover? foss_occ = p3(rate = 100, from = 0, to = 2.8) occ_after_ecol = apply_niche(foss_occ, niche_def = niche, gc = gradient) hist(occ_after_ecol, xlab = "Myr") # Between 1 nad 1.8 Myr fossil abundance is reduced because this coincides with deep whater # in which the recovery potential of the taxon is reduced (from 90 % to 10 %)# example workflow of how to construct discrete niches. For details on #how this can be used in conjunction with apply_niche, see documentation #therein of the vignette on event data # we model a simple niche, separated into "shallow water" and "deep water" bins = c("shallow water", "deep water") # taxon is more abundant in shallow water rec_prob = c(0.9, 0.1) # 90 % recovery probability in shallow water, 10 % in deep water niche = discrete_niche(bins = bins, rec_prob = rec_prob) # lets assume for the first 1 Myr, water is shallow, followed by 0.8 Myr of deep water, # and then 1 Myr of shallow water again # define discretized gradient using discrete_gradient gradient = discrete_gradient(vals = c("shallow water", "deep water", "shallow water"), bounds = c(0,1,1.8,2.8)) # assuming constant fossil abundance before ecological effects, how many fossils do we recover? foss_occ = p3(rate = 100, from = 0, to = 2.8) occ_after_ecol = apply_niche(foss_occ, niche_def = niche, gc = gradient) hist(occ_after_ecol, xlab = "Myr") # Between 1 nad 1.8 Myr fossil abundance is reduced because this coincides with deep whater # in which the recovery potential of the taxon is reduced (from 90 % to 10 %)
Constructs a gradient or taphonomic conditions from a dataframe or list. If x is a dataframe, the first two columns are used, if x is a list the first two elements are used. The first entry is used as time/stratigraphic position, and the second as gradient/recovery probability.
gradient_from_data(x)gradient_from_data(x)
x |
list or data frame |
a function for usage as gradient or taphonomic conditions, which can be passed to apply_taphonomy or apply_niche
# water depth 2 km offshore as gradient t = scenarioA$t_myr l = list(t, scenarioA$wd_m[,"2km"]) f = gradient_from_data(l) plot(t, f(t), type = "l")# water depth 2 km offshore as gradient t = scenarioA$t_myr l = list(t, scenarioA$wd_m[,"2km"]) f = gradient_from_data(l) plot(t, f(t), type = "l")
tests if x is a valid character matrix (char_mat object)
is_char_mat(x, ...)is_char_mat(x, ...)
x |
object to test |
... |
other parameters. Currently unused |
TRUE if x is a valid character matrix object, throws an informative error message otherwise
Determines the time and position of a taxons last occurrence as a function of time of extinction, fossil abundance, stratigraphy, ecology, and taphonomy. Effectively a high-level wrapper around p3/p3_var_rate, apply_niche, apply_taphonomy and time_to_strat/strat_to_time from the admtools package.
last_occ( t_ext, rate, adm, niche = trivial_niche, gc = trivial_gradient, niche_domain = "time", pres_potential = all_preserved, ctc = perfect_preservation, taphonomy_domain = "strat" )last_occ( t_ext, rate, adm, niche = trivial_niche, gc = trivial_gradient, niche_domain = "time", pres_potential = all_preserved, ctc = perfect_preservation, taphonomy_domain = "strat" )
t_ext |
true time of extinction |
rate |
either positive number or a function. If a number, rate of fossil occurrences passed to |
adm |
age-depth model |
niche |
niche model, by default the trivial niche |
gc |
gradient change for the niche mode, by default the trivial gradient. See |
niche_domain |
"time" or "strat" - in which domain should the niche model be applied? |
pres_potential |
preservation potential of fossils, by default all preserved (no taphonomic effects) |
ctc |
change in taphonomic conditions, by default no change in conditions. See |
taphonomy_domain |
"time" or "strat" - in which domain should the taphonomic effects be applied? |
a named vector with two entries:
"h": stratigraphic position of the last occurrence
"t": time of the last occurrence
range_offset() to quantify biostratigraphic precision
# last occurrences 2 km from shore h = scenarioA$h_m[,"2km"] adm = admtools::tp_to_adm(t = scenarioA$t_myr, h = h) l_occ = last_occ(t_ext = 1.8, rate = 5, adm = adm) l_occ # show timing and position of last occurrences# last occurrences 2 km from shore h = scenarioA$h_m[,"2km"] adm = admtools::tp_to_adm(t = scenarioA$t_myr, h = h) l_occ = last_occ(t_ext = 1.8, rate = 5, adm = adm) l_occ # show timing and position of last occurrences
Simulates an Ornstein-Uhlenbeck process using the Euler-Maruyama method. The process is simulated on a scale of 0.25 * min(diff(t)) and then interpolated to the values of t. Note that different parametrizations of OU processes are used in the literature. Here we use the parametrization common in mathematics. This translates to the parametrization used in evolutionary biology (specifically, the one in Hansen (1997)) as follows:
sigma is identical
mu used in the StratPal package corresponds to theta sensu Hansen (1997)
theta as used in the StratPal package corresponds to alpha sensu Hansen (1997)
ornstein_uhlenbeck(t, mu = 0, theta = 1, sigma = 1, y0 = 0)ornstein_uhlenbeck(t, mu = 0, theta = 1, sigma = 1, y0 = 0)
t |
times at which the process is simulated. Can be heterodistant |
mu |
number, long term mean |
theta |
number, mean reversion speed |
sigma |
positive number, strength of randomness |
y0 |
number, initial value (value of process at the first entry of t) |
A list with two elements: t and y. t is a duplicate of the input t, y are the values of the OU process at these times. Output list is of S3 class timelist (inherits from list) and can thus be plotted directly using plot, see ?admtools::plot.timelist
Hansen, Thomas F. 1997. “Stabilizing Selection and the Comparative Analysis of Adaptation.” Evolution 51 (5): 1341–51. doi:10.1111/j.1558-5646.1997.tb01457.x.
ornstein_uhlenbeck_sl() for simulation on specimen level - for use in conjunction with paleoTS package
random_walk() and stasis() to simulate other modes of evolution
library("admtools") # required for plotting of results t = seq(0, 3, by = 0.01) l = ornstein_uhlenbeck(t, y0 = 3) # start away from optimum (mu) plot(l, type = "l") l2 = ornstein_uhlenbeck(t, y0 = 0) # start in optimum lines(l2$t, l2$y, col = "red")library("admtools") # required for plotting of results t = seq(0, 3, by = 0.01) l = ornstein_uhlenbeck(t, y0 = 3) # start away from optimum (mu) plot(l, type = "l") l2 = ornstein_uhlenbeck(t, y0 = 0) # start in optimum lines(l2$t, l2$y, col = "red")
Simulates an Ornstein-Uhlenbeck process on specimen level (_sl). The mean trait value is simulated using the Euler-Maruyama method. The process is simulated on a scale of 0.25 * min(diff(t)) and then interpolated to the values of t. At each sampling location there are n_per_sample specimens that are normally distributed around the mean trait value with a variance of intrapop_var.
Note that different parametrizations of OU processes are used in the literature. Here we use the parametrization common in mathematics. This translates to the parametrization used in evolutionary biology (specifically, the one in Hansen (1997)) as follows:
sigma is identical
mu used in the StratPal package corresponds to theta sensu Hansen (1997)
theta as used in the StratPal package corresponds to alpha sensu Hansen (1997)
ornstein_uhlenbeck_sl( t, mu = 0, theta = 1, sigma = 1, y0 = 0, intrapop_var = 1, n_per_sample = 10 )ornstein_uhlenbeck_sl( t, mu = 0, theta = 1, sigma = 1, y0 = 0, intrapop_var = 1, n_per_sample = 10 )
t |
times at which the process is simulated. Can be heterodistant |
mu |
number, long term mean |
theta |
number, mean reversion speed |
sigma |
positive number, strength of randomness |
y0 |
number, initial value (value of process at the first entry of t) |
intrapop_var |
intrapopulation variance, determines how much specimens from the same population vary |
n_per_sample |
integer, number of specimens sampled per population/sampling locality |
an object of S3 class pre_paleoTS, inherits from timelist and list. The list has two elements: t, containing a vector of times of sampling, and vals, a list of trait values of the same length as t, with element containing trait values of individual specimens. This object can be transformed using apply_taphonomy, apply_niche or time_to_strat, and then reduced to a paleoTS object using reduce_to_paleoTS. This can then be used to test for different modes of evolution.
ornstein_uhlenbeck() to model mean trait values,
reduce_to_paleoTS() to transform outputs into paleoTS format
stasis_sl(), strict_stasis_sl() and random_walk_sl() to simulate other modes of evolution
library("paleoTS") x = ornstein_uhlenbeck_sl(1:5) y = reduce_to_paleoTS(x) # turn into paleoTS format plot(y) # plot using the paleoTS package # see also #vignette("paleoTS_functionality") #for details and advanced usagelibrary("paleoTS") x = ornstein_uhlenbeck_sl(1:5) y = reduce_to_paleoTS(x) # turn into paleoTS format plot(y) # plot using the paleoTS package # see also #vignette("paleoTS_functionality") #for details and advanced usage
Simulates events in the interval from to to based on a Poisson point process with rate rate. If the parameter n is used, the number of fossils is conditioned to be n
In the context of paleontology, these events can be interpreted as fossil occurrences or first/last occurrences of species. In this case, the rate is the average number of fossil occurrences (resp first/last occurrences) per unit
p3(rate, from, to, n = NULL)p3(rate, from, to, n = NULL)
rate |
strictly positive number, rate of events (avg events per unit) |
from |
lowest boundary of observed interval |
to |
upper boundary of observed interval |
n |
integer of NULL (default). Number of events to return. If NULL, the number is random and determined by the rate parameter |
a numeric vector with timing/location of events.
p3_var_rate() for the variable rate implementation
# for fossil occ. x = p3(rate = 5, from = 0, to = 1) # 5 fossil occurrences per myr on avg. hist(x, xlab = "Time (Myr)", ylab = "Fossil Occurrences" ) x = p3(rate = 3, from = 0, to = 4) hist(x, main = paste0(length(x), " samples")) # no of events is random x = p3(rate = 3, from = 0, to = 4, n = 10) hist(x, main = paste0(length(x), " samples")) # no of events is fixed to n # see also #vignette("event_data") # for details on usage and applications to paleontology# for fossil occ. x = p3(rate = 5, from = 0, to = 1) # 5 fossil occurrences per myr on avg. hist(x, xlab = "Time (Myr)", ylab = "Fossil Occurrences" ) x = p3(rate = 3, from = 0, to = 4) hist(x, main = paste0(length(x), " samples")) # no of events is random x = p3(rate = 3, from = 0, to = 4, n = 10) hist(x, main = paste0(length(x), " samples")) # no of events is fixed to n # see also #vignette("event_data") # for details on usage and applications to paleontology
simulates events based on a variable rate Poisson point process. Rates can be either specified by a function passed to x, or by providing two vectors x and y. In this case the rate is specified by approxfun(x, y, rule = 2), i.e. by linear interpolation between the values of x (abscissa) and y (ordinate). See ?approxfun for details.
In the context of paleontology, these events can be interpreted as fossil occurrences or first/last occurrences of species. In this case, the rate is the average number of fossil occurrences (resp first/last occurrences) per unit
p3_var_rate(x, y = NULL, from = 0, to = 1, f_max = 1, n = NULL)p3_var_rate(x, y = NULL, from = 0, to = 1, f_max = 1, n = NULL)
x |
numeric vector or function. If x is a function, it is used to specify the variable rate. If x is a vector, x and y together specify the variable rate using linear interpolation |
y |
numeric vector or NULL. If not NULL, determines the variable rate. This is done by using linear interpolation between the values of y. Here x specifies the ordinate and y the abscissa |
from |
lower boundary of the observed interval |
to |
upper boundary of the observed |
f_max |
maximum value of |
n |
NULL or an integer. Number of events drawn. If NULL, the number of events is determined by the rate (specified by x and y). If an integer is passed, n events are returned. |
numeric vector, timing/location of events. Depending on the modeling framework, these events can represent location/age of fossils, or first/last occurrences of a group of taxa.
p3() for the constant rate implementation, rej_samp() for the underlying random number generation.
# assuming events are fossil occurrences # then rate is the avg rate of fossil occ. per unit #linear decrease in rate from 50 at x = 0 to 0 at x = 1 x = c(0, 1) y = c(50, 0) s = p3_var_rate(x, y, f_max = 50) hist(s, xlab = "Time (myr)", main = "Fossil Occurrences") # conditioned to return 100 samples s = p3_var_rate(x, y, f_max = 50, n = 100) # hand over function s = p3_var_rate(x = sin, from = 0 , to = 3 * pi, n = 50) hist(s) # note that negative values of f (sin) are ignored in sampling # see also #vignette("event_data") # for details on usage and applications to paleontology# assuming events are fossil occurrences # then rate is the avg rate of fossil occ. per unit #linear decrease in rate from 50 at x = 0 to 0 at x = 1 x = c(0, 1) y = c(50, 0) s = p3_var_rate(x, y, f_max = 50) hist(s, xlab = "Time (myr)", main = "Fossil Occurrences") # conditioned to return 100 samples s = p3_var_rate(x, y, f_max = 50, n = 100) # hand over function s = p3_var_rate(x = sin, from = 0 , to = 3 * pi, n = 50) hist(s) # note that negative values of f (sin) are ignored in sampling # see also #vignette("event_data") # for details on usage and applications to paleontology
Models perfect taphonomic conditions. Mainly used as default input to last_occ and range_offset or passed as ctc argument to apply_taphonomy.
perfect_preservation(x)perfect_preservation(x)
x |
time/stratigraphic position at which the taphonomic conditions are determined |
A vector of the same length as x with all entries replaced by 1.
last_occ(), range_offset(), all_preserved(), and apply_taphonomy()
x = p3(rate = 10, 0, 1) # model fossils y = apply_taphonomy(x, pres_potential = all_preserved, ctc = perfect_preservation) all(x == y) # true, all fossils are preservedx = p3(rate = 10, 0, 1) # model fossils y = apply_taphonomy(x, pres_potential = all_preserved, ctc = perfect_preservation) all(x == y) # true, all fossils are preserved
This functions throws an error on purpose, as pre_paleoTS objects can not be plotted directly. To plot them, first use reduce_to_paleoTS and use plot on the results
## S3 method for class 'pre_paleoTS' plot(x, ...)## S3 method for class 'pre_paleoTS' plot(x, ...)
x |
object |
... |
other arguments |
## Not run: x = stasis_sl(1:4) # throws error plot(x) library("paleoTS") # correct way to plot pre-paleoTS objects y = reduce_to_paleoTs(x) plot(y) # this plots via the procedures of the paleoTS package (which must be installed and loaded) ## End(Not run)## Not run: x = stasis_sl(1:4) # throws error plot(x) library("paleoTS") # correct way to plot pre-paleoTS objects y = reduce_to_paleoTs(x) plot(y) # this plots via the procedures of the paleoTS package (which must be installed and loaded) ## End(Not run)
probabilistic removal of elements from x. For each element, the probability to be preserved is independent and specified by prob
prob_remove(x, prob)prob_remove(x, prob)
x |
vector |
prob |
number between 0 and 1, probability to preserve elements |
a vector of the same type as x
apply_niche() and apply_taphonomy() for functions that use this function for transformation of pre_paleoTS objects
x = prob_remove(1:10, 0.5) x x = prob_remove(1:10, 0.5) xx = prob_remove(1:10, 0.5) x x = prob_remove(1:10, 0.5) x
Simulates a (continuous time) random walk as a Brownian drift. For mu = 0 the random walk is unbiased, otherwise it is biased.
random_walk(t, sigma = 1, mu = 0, y0 = 0)random_walk(t, sigma = 1, mu = 0, y0 = 0)
t |
numeric vector with strictly increasing elements, can be heterodistant. Times at which the random walk is evaluated |
sigma |
positive number, variance parameter |
mu |
number, directionality parameter |
y0 |
number, starting value (value of the random walk at the first entry of |
A list with elements t and y. t is a duplicate of the input parameter and is the times at which the random walk is evaluated. y are the values of the random walk at said times. Output list is of S3 class timelist (inherits from list) and can thus be plotted directly using plot, see ?admtools::plot.timelist
stasis() and ornstein_uhlenbeck() to simulate other modes of evolution
random_walk_sl() to simulate random walk on specimen level - for usage in conjunction with the paleoTS package
library("admtools") # required for plotting of results t = seq(0, 1, by = 0.01) l = random_walk(t, sigma = 3) # high variability, no direction plot(l, type = "l") l2 = random_walk(t, mu = 1) # low variabliity, increasing trend lines(l2$t, l2$y, col = "red")library("admtools") # required for plotting of results t = seq(0, 1, by = 0.01) l = random_walk(t, sigma = 3) # high variability, no direction plot(l, type = "l") l2 = random_walk(t, mu = 1) # low variabliity, increasing trend lines(l2$t, l2$y, col = "red")
Simulates a (continuous time) random walk as a Brownian drift on specimen level. For mu = 0 the random walk is unbiased, otherwise it is biased.
random_walk_sl( t, sigma = 1, mu = 0, y0 = 0, intrapop_var = 1, n_per_sample = 10 )random_walk_sl( t, sigma = 1, mu = 0, y0 = 0, intrapop_var = 1, n_per_sample = 10 )
t |
numeric vector with strictly increasing elements, can be heterodistant. Times at which the random walk is evaluated |
sigma |
positive number, variance parameter |
mu |
number, directionality parameter |
y0 |
number, starting value (value of the random walk at the first entry of |
intrapop_var |
intrapopulation variance, determines how much specimens from the same population vary |
n_per_sample |
integer, number of specimens sampled per population/sampling locality |
an object of S3 class pre_paleoTS, inherits from timelist and list. The list has two elements: t, containing a vector of times of sampling, and vals, a list of trait values of the same length as t, with element containing trait values of individual specimens. This object can be transformed using apply_taphonomy, apply_niche or time_to_strat, and then reduced to a paleoTS object using reduce_to_paleoTS. This can then be used to test for different modes of evolution.
random_walk() for the equivalent function to simulate mean trait values
reduce_to_paleoTS() to transform outputs into paleoTS format.
stasis_sl(), strict_stasis_sl() and ornstein_uhlenbeck_sl() to simulate other modes of evolution
library("paleoTS") x = random_walk_sl(1:5) y = reduce_to_paleoTS(x) # turn into paleoTS format plot(y) # plot using the paleoTS package # see also #vignette("paleoTS_functionality") #for details and advanced usagelibrary("paleoTS") x = random_walk_sl(1:5) y = reduce_to_paleoTS(x) # turn into paleoTS format plot(y) # plot using the paleoTS package # see also #vignette("paleoTS_functionality") #for details and advanced usage
Determines temporal and stratigraphic range offset, a measure of biostratigraphic precision, as a function of time of extinction, fossil abundance, stratigraphy, ecology, and taphonomy. Effectively a high-level wrapper around last_occ, p3/p3_var_rate, apply_niche, apply_taphonomy and time_to_strat/strat_to_time from the admtools package.
range_offset( t_ext, rate, adm, niche = trivial_niche, gc = trivial_gradient, niche_domain = "time", pres_potential = all_preserved, ctc = perfect_preservation, taphonomy_domain = "strat" )range_offset( t_ext, rate, adm, niche = trivial_niche, gc = trivial_gradient, niche_domain = "time", pres_potential = all_preserved, ctc = perfect_preservation, taphonomy_domain = "strat" )
t_ext |
true time of extinction |
rate |
either positive number or a function. If a number, rate of fossil occurrences passed to |
adm |
age-depth model |
niche |
niche model, by default the trivial niche |
gc |
gradient change for the niche mode, by default the trivial gradient. See |
niche_domain |
"time" or "strat" - in which domain should the niche model be applied? |
pres_potential |
preservation potential of fossils, by default all preserved (no taphonomic effects) |
ctc |
change in taphonomic conditions, by default no change in conditions. See |
taphonomy_domain |
"time" or "strat" - in which domain should the taphonomic effects be applied? |
a named vector with two entries:
"h": distance between last occurrence and true height of extinction
"t": time between last occurrence and true time of extinction
last_occ() determine position/time of last occurrence of taxon
# last occurrences 2 km from shore h = scenarioA$h_m[,"2km"] adm = admtools::tp_to_adm(t = scenarioA$t_myr, h = h) offset = range_offset(t_ext = 1.8, rate = 5, adm = adm) offset # show timing and position of last occurrences# last occurrences 2 km from shore h = scenarioA$h_m[,"2km"] adm = admtools::tp_to_adm(t = scenarioA$t_myr, h = h) offset = range_offset(t_ext = 1.8, rate = 5, adm = adm) offset # show timing and position of last occurrences
paleoTS is a format for paleontological time series. It is a summary format where interpopulation variance is provided as a parameter. As a result, taphonomic and ecological effects that act on individual specimens can not be modeled for paleoTS objects. To resolve this, the pre_paleoTS format tracks each specimen individually. This function reduces the pre-paleoTS format into standard paleoTS object, which can be used by the paleoTS package.
reduce_to_paleoTS(x, min_n = 1, na.rm = TRUE, ...)reduce_to_paleoTS(x, min_n = 1, na.rm = TRUE, ...)
x |
a |
min_n |
minimum number of specimens. If the number of specimens at a sampling location falls below this number, the sampling location will be removed |
na.rm |
Logical. If sampling locations are NA (e.g., because of erosion), should the sample be removed? |
... |
other options. currently unused |
a paleoTS object
stasis_sl(), strict_stasis_sl, random_walk_sl, and ornstein_uhlenbeck_sl() to simulate trait evolution on specimen level (sl), returning an object of type pre_paleoTS
x = stasis_sl(t = 0:5) # create pre_paleoTS object representing stasis on specimen level y = reduce_to_paleoTS(x) # reduce to standard paleoTS format plot(y) # now analyses using the paleoTS package can be applied to yx = stasis_sl(t = 0:5) # create pre_paleoTS object representing stasis on specimen level y = reduce_to_paleoTS(x) # reduce to standard paleoTS format plot(y) # now analyses using the paleoTS package can be applied to y
Rejection sampling from the (pseudo) pdf f in the interval between x_min and x_max. Returns n samples. Note that values of f below 0 are capped to zero
rej_samp(f, x_min, x_max, n = 1L, f_max = 1, max_try = 10^4)rej_samp(f, x_min, x_max, n = 1L, f_max = 1, max_try = 10^4)
f |
function. (pseudo) pdf from which the sample is drawn |
x_min |
number, lower limit of the examined interval |
x_max |
number, upper limit of the examined interval |
n |
integer. number of samples drawn |
f_max |
number, maximum value of |
max_try |
maximum number of tries in the rejection sampling algorithm. If more tries are needed, an error is thrown. If this is the case, inspect of your function |
numeric vector, sample of size n drawn from the (pseudo) pdf specified by f
p3_var_rate() for the derived variable rate Poisson point process implementation.
f = sin x = rej_samp(f, 0, 3*pi, n = 100) hist(x) # note that no samples are drawn where sin is negativef = sin x = rej_samp(f, 0, 3*pi, n = 100) hist(x) # note that no samples are drawn where sin is negative
Reproduces Scenario A as described in Hohmann et al. (2024), published in Hohmann et al. (2023) using CarboKitten (Hidding et al. 2025), built on CarboCAT Lite (Burgess 2013, 2023)
Contains stratigraphic architectures from a synthetic carbonate platform. See vignette("stratigraphic_architecture") for a full description of the platform.
scenarioAscenarioA
A list with 5 elements:
t_myr : numeric vector. timesteps of the simulation in Myr
sl_m : numeric vector. eustatic sea level in m
dist_from_shore : character vector. Distance from shore in km of locations at which the observations were made. Available distances are "2km", "4km", "6km", "8km", "10km", "12km".
h_m : matrix of size length(t_myr) x length(dist_from_shore). Accumulated sediment height in m at examined locations
wd_m: matrix of size length(t_myr) x length(dist_from_shore). Water depth in m at examined locations
Hidding, Johan, Jarochowska, Emilia, Hohmann, Niklas, Liu, Xianyi Burgess, Peter and Spreeuw, Hanno: "CarboKitten.jl – an open source toolkit for carbonate stratigraphic modeling." Preprint. doi:10.5194/egusphere-2025-4561
Burgess, Peter. 2013. "CarboCAT: A cellular automata model of heterogeneous carbonate strata." Computers & Geosciences. doi:10.1016/j.cageo.2011.08.026.
Burgess, Peter. 2023. "CarboCATLite v1.0.1." Zenodo. doi:10.5281/zenodo.8402578
Hohmann, Niklas; Koelewijn, Joël R.; Burgess, Peter; Jarochowska, Emilia. 2024. "Identification of the mode of evolution in incomplete carbonate successions." BMC Ecology and Evolution 24, 113. doi:10.1186/s12862-024-02287-2.
Hohmann, Niklas, Koelewijn, Joël R.; Burgess, Peter; Jarochowska, Emilia. 2023. “Identification of the Mode of Evolution in Incomplete Carbonate Successions - Supporting Data.” Open Science Framework. doi:10.17605/OSF.IO/ZBPWA, published under the CC-BY 4.0 license.
Defines niche model based in the "Probability of collection" model by Holland and Patzkowsky (1999).
The collection probability follows the shape of a bell curve across a gradient, where opt determines the peak (mean) of the bell curve, and tol the standard deviation. "snd" stands for "scaled normal distribution", as the collection probability has the shape of the probability density of the normal distribution.
snd_niche(opt, tol, prob_modifier = 1, cutoff_val = NULL)snd_niche(opt, tol, prob_modifier = 1, cutoff_val = NULL)
opt |
optimum value, gradient value where collection probability is highest |
tol |
tolerance to changes in gradient. For large values, collection probability drops off slower away from |
prob_modifier |
collection probability modifier, collection probability at |
cutoff_val |
NULL or a number. If a number, all collection probabilities at gradient values below |
a function for usage with apply_niche.
Holland, Steven M. and Patzkowsky, Mark E. 1999. "Models for simulating the fossil record." Geology. https://doi.org/10.1130/0091-7613(1999)027%3C0491:MFSTFR%3E2.3.CO;2
apply_niche() for usage of the returned function
bounded_niche() for another niche model
trivial_niche() to model organisms without niche specifications
discrete_niche() and discrete_gradient() to define niches based on discrete categories
vignette("advenced_functionality") for details on how to create user defined niche models
# using water depth as niche wd = seq(-3, 40, by = 0.5) f = snd_niche(opt = 10, tol = 5) plot(wd, f(wd), xlab = "Water depth", ylab = "Prob. of collection") # set cutoff value at to 0 to model non-terrestrial species. f = snd_niche(opt = 10, tol = 5, cutoff_val = 0) plot(wd, f(wd), xlab = "Water depth", ylab = "Prob. of collection") # see also #vignette("event_data") #for examples how to use it for niche modeling# using water depth as niche wd = seq(-3, 40, by = 0.5) f = snd_niche(opt = 10, tol = 5) plot(wd, f(wd), xlab = "Water depth", ylab = "Prob. of collection") # set cutoff value at to 0 to model non-terrestrial species. f = snd_niche(opt = 10, tol = 5, cutoff_val = 0) plot(wd, f(wd), xlab = "Water depth", ylab = "Prob. of collection") # see also #vignette("event_data") #for examples how to use it for niche modeling
Simulates stasis of mean trait values as independent, normally distributed random variables with mean mean and standard deviation sd
stasis(t, mean = 0, sd = 1)stasis(t, mean = 0, sd = 1)
t |
times at which the traits are determined |
mean |
number, mean trait value |
sd |
strictly positive number, standard deviation of traits |
A list with two elements: t and y. t is a duplicate of the input t, y are the corresponding trait values. Output list is of S3 class timelist (inherits from list) and can thus be plotted directly using plot, see ?admtools::plot.timelist
random_walk() and ornstein_uhlenbeck() to simulate other modes of evolution
stasis_sl() to simulate stasis on specimen level - for usage in conjunction with the paleoTS package.
library("admtools") # required for plotting of results t = seq(0, 1, by = 0.01) l = stasis(t) plot(l, type = "l") # plot lineage l2 = stasis(t, mean = 0.5, sd = 0.3) # simulate second lineage lines(l2$t, l2$y, col = "red") # plot second lineagelibrary("admtools") # required for plotting of results t = seq(0, 1, by = 0.01) l = stasis(t) plot(l, type = "l") # plot lineage l2 = stasis(t, mean = 0.5, sd = 0.3) # simulate second lineage lines(l2$t, l2$y, col = "red") # plot second lineage
simulates stasis as independent, normally distributed random variables with mean mean and standard deviation sd, draws n_per_sample samples from each sampling location (population) that have specified variance intrapop_var
stasis_sl(t, mean = 0, sd = 1, intrapop_var = 1, n_per_sample = 10)stasis_sl(t, mean = 0, sd = 1, intrapop_var = 1, n_per_sample = 10)
t |
times at which the traits are determined |
mean |
mean trait value |
sd |
strictly positive number, standard deviation of traits around the mean |
intrapop_var |
intrapopulation variance, determines how much specimens from the same population vary |
n_per_sample |
integer, number of specimens sampled per population/sampling locality |
an object of S3 class pre_paleoTS, inherits from timelist and list. The list has two elements: t, containing a vector of times of sampling, and vals, a list of trait values of the same length as t, with element containing trait values of individual specimens. This object can be transformed using apply_taphonomy, apply_niche or time_to_strat, and then reduced to a paleoTS object using reduce_to_paleoTS. This can then be used to test for different modes of evolution.
stasis() for the version that simulates stasis of mean trait values
strict_stasis_sl() for more narrow definition of stasis
reduce_to_paleoTS() to transform into the outputs into paleoTS format (e.g., for plotting or further analysis)
random_walk_sl() and ornstein_uhlenbeck_sl() for other modes of evolution
library("paleoTS") x = stasis_sl(1:5, mean = 2, sd = 2) y = reduce_to_paleoTS(x) # turn into paleoTS format plot(y) # plot using paleoTS package # see also #vignette("paleoTS_functionality") #for details and advanced usagelibrary("paleoTS") x = stasis_sl(1:5, mean = 2, sd = 2) y = reduce_to_paleoTS(x) # turn into paleoTS format plot(y) # plot using paleoTS package # see also #vignette("paleoTS_functionality") #for details and advanced usage
Generates a simple stratigraphic filter, meaning a function that
returns 0 if its argument coincides with a hiatus, and 1 if it does not.
Can be used for simple time-domain filtering using apply_niche or apply_taphonomy (see example)
strat_filter(adm, ...)strat_filter(adm, ...)
adm |
an age-depth model ( |
... |
further parameters passed to |
a function taking as argument a vector of times and returning a vector of equal length with entries 1 if the time coincides with deposition and 0 if it coincides with a gap
apply_taphonomy(), where the stratigraphic filter can be applied as gradient (see example below)
# define age-depth model from example data adm = admtools::tp_to_adm(t = scenarioA$t_myr, h = scenarioA$h_m[,"2km"]) f = strat_filter(adm) # collection probability of 0 at 0.5 Myr & 1 at 1.0 Myr f(c(0.5, 1.0)) # define fossil occurrences occ = p3(rate = 2, from = 0, to = 2, n = 100) # filter those that are not coinciding with hiatuses occ_filter = apply_taphonomy(occ, identity, f) hist(occ_filter, breaks = seq(0, 2, by = 0.2))# define age-depth model from example data adm = admtools::tp_to_adm(t = scenarioA$t_myr, h = scenarioA$h_m[,"2km"]) f = strat_filter(adm) # collection probability of 0 at 0.5 Myr & 1 at 1.0 Myr f(c(0.5, 1.0)) # define fossil occurrences occ = p3(rate = 2, from = 0, to = 2, n = 100) # filter those that are not coinciding with hiatuses occ_filter = apply_taphonomy(occ, identity, f) hist(occ_filter, breaks = seq(0, 2, by = 0.2))
simulates strict stasis on the population level (Hunt et al. 2015). This means each population has the same mean trait value, and all deviations are due to the fact that specimens traits differ from this value due to randomness.
strict_stasis_sl(t, mean = 0, intrapop_var = 1, n_per_sample = 10)strict_stasis_sl(t, mean = 0, intrapop_var = 1, n_per_sample = 10)
t |
times at which the traits are determined |
mean |
mean trait value |
intrapop_var |
intrapopulation variance, determines how much specimens from the same population vary |
n_per_sample |
integer, number of specimens sampled per population/sampling locality/time |
an object of S3 class pre_paleoTS, inherits from timelist and list. The list has two elements: t, containing a vector of times of sampling, and vals, a list of trait values of the same length as t, with element containing trait values of individual specimens. This object can be transformed using apply_taphonomy, apply_niche or time_to_strat, and then reduced to a paleoTS object using reduce_to_paleoTS. This can then be used to test for different modes of evolution.
Hunt, Gene, Melanie J. Hopkins, and Scott Lidgard. 2015. “Simple versus Complex Models of Trait Evolution and Stasis as a Response to Environmental Change.” Proceedings of the National Academy of Sciences of the United States of America 112 (16): 4885–90. https://doi.org/10.1073/pnas.1403662111.
stasis_sl() for the (non-strict) equivalent
reduce_to_paleoTS() to transform outputs into paleoTS format
random_walk_sl() and ornstein_uhlenbeck_sl() for other modes of evolution
library("paleoTS") x = strict_stasis_sl(1:5, mean = 2, intrapop_var = 2) # simulate strict stasis y = reduce_to_paleoTS(x) # transform into paloeTS format plot(y) # plot using paleoTS package # see also #vignette("paleoTS_functionality") #for details and advanced usagelibrary("paleoTS") x = strict_stasis_sl(1:5, mean = 2, intrapop_var = 2) # simulate strict stasis y = reduce_to_paleoTS(x) # transform into paloeTS format plot(y) # plot using paleoTS package # see also #vignette("paleoTS_functionality") #for details and advanced usage
Thins a vector of events using the function thin, meaning the probability that the ith event in x is preserved is given by thin(x(i)). Values of
thin below 0 and above 1 are ignored.
Is used to model niche preferences in apply_niche and taphonomic effects in apply_taphonomy.
thin(x, thin)thin(x, thin)
x |
numeric vectors with events (e.g. locations, height, times) |
thin |
a function used for thinning |
numeric vector, events after thinning. Depending on the modeling framework, these events can represent fossil ages/locations or first/last occurrences, and the thinning taphonomic or ecological effects.
apply_niche() and apply_taphonomy() for use cases with biological meaning. Use thin to model effects of taphonomy and ecology for event data.
x = p3(rate = 100, from = 0, to = 3 * pi) # simulate Poisson point process y = thin(x, sin) hist(y) # not how negative values of sin are treated as 0 yy = thin(x, function(x) 5 * sin(x)) hist(yy) # note how values of 5 * sin above 1 are not affecting the thinningx = p3(rate = 100, from = 0, to = 3 * pi) # simulate Poisson point process y = thin(x, sin) hist(y) # not how negative values of sin are treated as 0 yy = thin(x, function(x) 5 * sin(x)) hist(yy) # note how values of 5 * sin above 1 are not affecting the thinning
Models a constant gradient with value 1. Mainly used as default input to last_occ and range_offset.
trivial_gradient(x)trivial_gradient(x)
x |
time/stratigraphic position at which the gradient is determined |
A vector of the same length as x with all entries replaced by 1.
last_occ(), range_offset(), trivial_niche(), and apply_niche()
x = p3(rate = 10, from = 0, to = 1) # model fossil occurrences # apply trivial niche model y = apply_niche(x, niche_def = trivial_niche, gc = trivial_gradient) all(x == y) # true, no fossils were removedx = p3(rate = 10, from = 0, to = 1) # model fossil occurrences # apply trivial niche model y = apply_niche(x, niche_def = trivial_niche, gc = trivial_gradient) all(x == y) # true, no fossils were removed
Models a trivial niche, meaning the niche of a taxon that has no environmental preferences. Mainly used as default input to last_occ and range_offset. When passed to apply_niche, this will effectively result in no niche model being applied.
trivial_niche(x)trivial_niche(x)
x |
gradient value at which the niche is evaluated |
A vector of the same length as x with all entries replaced by 1.
last_occ(), range_offset(), trivial_gradient() and apply_niche()
x = p3(rate = 10, from = 0, to = 1) # model fossil occurrences # apply trivial niche model y = apply_niche(x, niche_def = trivial_niche, gc = trivial_gradient) all(x == y) # true, no fossils were removedx = p3(rate = 10, from = 0, to = 1) # model fossil occurrences # apply trivial niche model y = apply_niche(x, niche_def = trivial_niche, gc = trivial_gradient) all(x == y) # true, no fossils were removed