Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (19.2%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Basic Info
Statistics
  • Stars: 3
  • Watchers: 2
  • Forks: 0
  • Open Issues: 2
  • Releases: 4
Created almost 4 years ago · Last pushed 10 months ago
Metadata Files
Readme Changelog

README.Rmd

---
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
set.seed(2024)
```

# nhppp  


[![Codecov test coverage](https://codecov.io/gh/bladder-ca/nhppp/branch/main/graph/badge.svg)](https://app.codecov.io/gh/bladder-ca/nhppp?branch=main)
[![R-CMD-check](https://github.com/bladder-ca/nhppp/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/bladder-ca/nhppp/actions/workflows/R-CMD-check.yaml)


nhppp is a package for simulating events from one dimensional nonhomogeneous Poisson point processes (NHPPPs). Its functions are based on three algorithms that provably sample from a target NHPPP: the time-transformation of a homogeneous Poisson process (of intensity one) via the inverse of the integrated intensity function; the generation of a Poisson number of order statistics from a fixed density function; and the thinning of a majorizing NHPPP via an acceptance-rejection scheme. It was developed to provide fast and memory efficient functions for discrete event and statistical simulations. For a description of the algorithms and a numerical comparison with other R packages, see Trikalinos and Sereda (2024), accessible at [https://arxiv.org/abs/2402.00358](https://arxiv.org/abs/2402.00358). 

## Installation

You can install the release version of nhppp from [CRAN](https://cran.r-project.org) with:

``` r
install.packages("nhppp")
```

You can install the development version of nhppp from [GitHub](https://github.com/) with:

``` r
# install.packages("devtools")
devtools::install_github("bladder-ca/nhppp")
```

## Example

These examples use the generic function `draw()`, which is a wrapper for the packages specific functions. `draw()` is a non-vectorized function, but `nhppp` includes vectorized functions that are fast and have small memory footprint. 

Consider the time varying intensity function $\lambda(t) = e^{(0.2t)} (1 + \sin t)$, which is a sinusoidal intensity function with an exponential amplitude. To draw samples over the interval $(0, 6\pi]$ execute 

```{r example_lambda}
l <- function(t) (1 + sin(t)) * exp(0.2 * t)
nhppp::draw(
  lambda = l,
  line_majorizer_intercept = l(6 * pi),
  line_majorizer_slope = 0,
  t_min = 0,
  t_max = 6 * pi
) |>
  head(n = 20)
```

where `line_majorizer_intercept` and `line_majorizer_slope` define a majorizer constant. 

When available, the integrated intensity function $\Lambda(t) = \int_0^t \lambda(s) \ ds$ and its inverse $\Lambda^{-1}(z)$ result in faster simulation times. For this example, $\Lambda(t) = \frac{e^{0.2t}(0.2 \sin t - \cos t)+1}{1.04} + \frac{e^{0.2t} - 1}{0.2}$; $\Lambda^{-1}(z)$ is constructed numerically upfront (or can be calculated numerically by the function, at a computational cost). 

```{r example_big_lambda}
L <- function(t) {
  exp(0.2 * t) * (0.2 * sin(t) - cos(t)) / 1.04 +
    exp(0.2 * t) / 0.2 - 4.038462
}
Li <- stats::approxfun(x = L(seq(0, 6 * pi, 10^-3)), y = seq(0, 6 * pi, 10^-3), rule = 2)

nhppp::draw(Lambda = L, Lambda_inv = Li, t_min = 0, t_max = 6 * pi) |>
  head(n = 20)
```

## Vectorized functions 

See the vignette "Log-linear times". 

Owner

  • Name: Bladder Cancer Site
  • Login: bladder-ca
  • Kind: organization

GitHub Events

Total
  • Create event: 5
  • Release event: 2
  • Issues event: 12
  • Watch event: 2
  • Delete event: 1
  • Issue comment event: 4
  • Push event: 71
  • Pull request event: 20
Last Year
  • Create event: 5
  • Release event: 2
  • Issues event: 12
  • Watch event: 2
  • Delete event: 1
  • Issue comment event: 4
  • Push event: 71
  • Pull request event: 20

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 4
  • Total pull requests: 2
  • Average time to close issues: 4 months
  • Average time to close pull requests: 9 days
  • Total issue authors: 1
  • Total pull request authors: 1
  • Average comments per issue: 0.5
  • Average comments per pull request: 0.5
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 3
  • Pull requests: 2
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 9 days
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 0.33
  • Average comments per pull request: 0.5
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • ttrikalin (12)
  • yuliia-sereda (1)
Pull Request Authors
  • ttrikalin (13)
Top Labels
Issue Labels
bug (2)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 304 last-month
  • Total docker downloads: 32
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 4
  • Total maintainers: 1
cran.r-project.org: nhppp

Simulating Nonhomogeneous Poisson Point Processes

  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 304 Last month
  • Docker Downloads: 32
Rankings
Dependent packages count: 28.2%
Dependent repos count: 36.1%
Average: 49.6%
Downloads: 84.4%
Maintainers (1)
Last synced: 10 months ago

Dependencies

DESCRIPTION cran
  • rstream * imports
  • testthat >= 3.0.0 suggests
.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v3 composite
  • actions/upload-artifact v3 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite