Skip to content

Commit

Permalink
Merge pull request #22 from MindTheGap-ERC/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
NiklasHohmann authored Oct 14, 2024
2 parents 1696240 + 5415ccf commit 286d6bc
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: StratPal
Title: Stratigraphic Paleobiology Modeling Pipelines
Version: 0.2.0.9000
Version: 0.2.0.9001
Authors@R:
person("Niklas", "Hohmann", , "N.H.Hohmann@uu.nl", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-1559-1838"))
Expand Down
2 changes: 1 addition & 1 deletion R/apply_niche.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ apply_niche.pre_paleoTS = function(x, niche_def, gc){
thin_vals = change_in_niche(x$t)
for (i in seq_along(thin_vals)){
r = prob_remove(x$vals[[i]], prob = thin_vals[i])
x$vals[[i]] = x$vals[[i]][as.logical(r)]
x$vals[[i]] = r
}
return(x)
}
2 changes: 1 addition & 1 deletion R/apply_taphonomy.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ apply_taphonomy.pre_paleoTS = function(x, pres_potential, ctc){
}
for (i in seq_along(thin_vals)){
r = prob_remove(x$vals[[i]], prob = thin_vals[i])
x$vals[[i]] = x$vals[[i]][as.logical(r)]
x$vals[[i]] = r
}
return(x)
}
2 changes: 1 addition & 1 deletion R/ornstein_uhlenbeck_sl.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ornstein_uhlenbeck_sl = function(t, mu = 0, theta = 1, sigma = 1, y0 = 0, intrap
#' @param theta number, mean reversion speed
#' @param sigma positive number, strength of randomness
#' @param y0 number, initial value (value of process at the first entry of t)
#' @param intrapop_var intrapopulation variance, determines how many specimens from the same population vary
#' @param intrapop_var intrapopulation variance, determines how much specimens from the same population vary
#' @param n_per_sample integer, number of specimens sampled per population/sampling locality
#'
#' @description
Expand Down
2 changes: 1 addition & 1 deletion R/random_walk_sl.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ random_walk_sl = function(t, sigma = 1, mu = 0, y0 = 0, intrapop_var = 1, n_per_
#' @param sigma positive number, variance parameter
#' @param mu number, directionality parameter
#' @param y0 number, starting value (value of the random walk at the first entry of `t`)
#' @param intrapop_var intrapopulation variance, determines how many specimens from the same population vary
#' @param intrapop_var intrapopulation variance, determines how much specimens from the same population vary
#' @param n_per_sample integer, number of specimens sampled per population/sampling locality
#'
#' @description
Expand Down
5 changes: 4 additions & 1 deletion inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Jere
Joël
Koelewijn
Lande
Lidgard
Lipps
MFSTFR
Maruyama
Expand All @@ -34,7 +35,6 @@ Taphonomy
Uhlenbeck
Zenodo
al
approxfun
artefactual
automata
cff
Expand All @@ -54,6 +54,7 @@ heterodistant
hohmann
https
interpopulation
intrapopulation
io
ith
kyr
Expand All @@ -65,6 +66,7 @@ ornstein
paleoTS
paleobiology
paleontological
pnas
pre
sedimentological
siliciclastic
Expand All @@ -76,5 +78,6 @@ taphonomic
taphonomy
timelist
uhlenbeck
un
uu
vectorized
2 changes: 1 addition & 1 deletion man/ornstein_uhlenbeck_sl.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/random_walk_sl.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vignettes/event_data.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ for details on how to expand on the modeling pipelines described here, or explor

- 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. <https://doi.org/10.1186/s12862-024-02287-2>.

- 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](https://doi.org/10.1130/0091-7613(1999)027%3C0491:MFSTFR%3E2.3.CO;2){.uri}
- 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>

- Holland, Steven M. and Patzkowsky, Mark E. 2015. "The stratigraphy of mass extinction." Palaeontology. <https://doi.org/10.1111/pala.12188>.

Expand Down
6 changes: 3 additions & 3 deletions vignettes/paleoTS_functionality.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ The `paleoTS` package defines its own `paleoTS` format to store time series. It

Functions to model trait evolution on specimen level have the suffix `_sl`, standing for "specimen level". Internally, they are of S3 class `pre_paleoTS`. In addition to the options provided to simulate mean trait values, you can simulate strict stasis using `strict_stasis_sl`. All functions have the same parametrization as the as the other functions for simulating trait evolution, which simulate mean trait evolution. In addition, they take two additional parameters: `intrapop_var` for the variance of the population around the mean trait value, and `n_per_sample` for the number of specimens per sampling location.

`pre_paleoTS` results can be converted to the `paleoTS` format using the function `reduce_to_paleoTS`. After this you can plot them with the standard plotting procedure from paleoTS using `plot` (resp, `plot.paleoTS`). Note that you can not plot `pre_paloeTS` objects directly, only after conversion to `paleoTS`.
`pre_paleoTS` results can be converted to the `paleoTS` format using the function `reduce_to_paleoTS`. After this you can plot them with the standard plotting procedure from paleoTS using `plot` (resp, `plot.paleoTS`). Note that you can not plot `pre_paloeTS` objects directly, only after conversion to `paleoTS` format.

```{r fig.alt="plot of strict stasis"}
library(StratPal)
Expand All @@ -62,7 +62,7 @@ adm = tp_to_adm(t = scenarioA$t_myr, # define age-depth model
T_unit = "Myr")
set.seed(42) # set seed for reproducibility
seq(min_time(adm), max_time(adm), by = 0.01) |> # sample every 0.01 Myr
random_walk_sl(n_per_sample = 10) |> # simulate random walk on specimen level
random_walk_sl(n_per_sample = 5) |> # simulate random walk on specimen level
time_to_strat(adm) |> # transform into stratigraphic domain
reduce_to_paleoTS() |> # transform into paleoTS format
plot() # plot
Expand All @@ -73,7 +73,7 @@ Of course you can also immediately add functions from `paleoTS` to the pipeline,
```{r}
set.seed(42) # set seed for reproducibility
seq(min_time(adm), max_time(adm), by = 0.01) |> # sample every 0.01 Myr
random_walk_sl(n_per_sample = 10) |> # simulate random walk on specimen level
random_walk_sl(n_per_sample = 5) |> # simulate random walk on specimen level
time_to_strat(adm) |> # transform into stratigraphic domain
reduce_to_paleoTS() |> # transform into paleoTS format
fit3models() # fit 3 models to time series
Expand Down

0 comments on commit 286d6bc

Please sign in to comment.