PhaseTypeR

PhaseTypeR: an R package for phase-type distributions in population genetics - Published in JOSS (2023)

https://github.com/rivasiker/phasetyper

Science Score: 93.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
    Found 4 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: joss.theoj.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Scientific Fields

Sociology Social Sciences - 64% confidence
Last synced: 4 months ago · JSON representation

Repository

General-purpose phase-type functions

Basic Info
Statistics
  • Stars: 2
  • Watchers: 2
  • Forks: 1
  • Open Issues: 0
  • Releases: 6
Created over 4 years ago · Last pushed over 2 years ago
Metadata Files
Readme Changelog Contributing License Code of conduct

README.Rmd

---
output: github_document
---



```{r, echo = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/"
)
```

# PhaseTypeR: general-purpose phase-type functions


[![DOI](https://joss.theoj.org/papers/10.21105/joss.05054/status.svg)](https://doi.org/10.21105/joss.05054)
[![R-CMD-check](https://github.com/rivasiker/PhaseTypeR/actions/workflows/check-standard.yaml/badge.svg)](https://github.com/rivasiker/PhaseTypeR/actions/workflows/check-standard.yaml)
[![CRAN](https://www.r-pkg.org/badges/version/PhaseTypeR)](https://CRAN.R-project.org/package=PhaseTypeR)
[![devel Version](https://img.shields.io/badge/devel-1.0.5.9000-brightgreen.svg)](https://github.com/rivasiker/PhaseTypeR)
[![downloads](https://cranlogs.r-pkg.org/badges/grand-total/PhaseTypeR)](https://CRAN.R-project.org/package=PhaseTypeR)
[![Codecov test coverage](https://codecov.io/gh/rivasiker/PhaseTypeR/branch/master/graph/badge.svg)](https://app.codecov.io/gh/rivasiker/PhaseTypeR?branch=master)



This package implements core functions from phase-type theory. Its general functions are useful for a wide-ranging variety of contexts. `PhaseTypeR` can be used to model continuous and discrete phase-type distributions, both univariate and multivariate. The package includes functions for outputting the mean and (co)variance of phase-type distributions; their density, probability and quantile functions; functions for random draws; functions for reward-transformation; and functions for plotting the distributions as networks. 

## Installation

You can install `PhaseTypeR` from CRAN via:

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

If you install devtools in your R environment with `install.packages("devtools")`, the development version of the package can be installed with the following command:

``` r
devtools::install_github("rivasiker/PhaseTypeR")
```

These installations should handle the missing dependencies, but you can manually install them by running the following:

``` r
install.packages("expm")
install.packages("igraph")
```

## Basic example

This is a basic example for the univariate continuous phase-type distribution.

```{r warning=FALSE, message=FALSE}
# Load the package
library(PhaseTypeR)

# Define the sub-intensity rate matrix
subintensity_matrix <- matrix(c(-1.5,  0,  0,
                                 1.5, -1,  0,
                                  0,   1, -0.5), ncol = 3)
# Define the initial probabilities
initial_probabilities <- c(0.9, 0.1, 0)

# Create continuous phase-type object
ph <- PH(subintensity_matrix, initial_probabilities)
```

Summary of the object:

```{r}
summary(ph)
```


Density function:

```{r}
dPH(1:5, ph)
```

Cumulative density function:

```{r}
pPH(1:5, ph)
```

Quantile function:

```{r}
qPH(c(0.25, 0.5, 0.75), ph)
```

Random sampling:

```{r}
set.seed(0)
rPH(6, ph)
```

## Learn more

You can check out the full functionality of `PhaseTypeR` and its application to 
population genetics in the following guides:

  - [Getting Started](https://rivasiker.github.io/PhaseTypeR/articles/PhaseTypeR.html)
  - [Using PhaseTypeR for population genetics](https://rivasiker.github.io/PhaseTypeR/articles/a2_pop_gen_iker.html)
  - [Using PhaseTypeR for the site frequency spectrum](https://rivasiker.github.io/PhaseTypeR/articles/a3_phasetypeR_SFS.html)
  
## Report an issue

If you have found a bug, you can file an issue at . Please, make sure to read the [contribution guidelines](.github/CONTRIBUTING.md) and the [code of conduct](.github/CODE_OF_CONDUCT.md) before making any changes. 

Owner

  • Name: Iker Rivas-González
  • Login: rivasiker
  • Kind: user
  • Location: Aarhus
  • Company: Aarhus University

Bioinformatics PhD student at Aarhus University

JOSS Publication

PhaseTypeR: an R package for phase-type distributions in population genetics
Published
February 21, 2023
Volume 8, Issue 82, Page 5054
Authors
Iker Rivas-González ORCID
Bioinformatics Research Centre, Aarhus University, Denmark
Lars Nørvang Andersen ORCID
Department of Mathematics, Aarhus University, Denmark
Asger Hobolth ORCID
Department of Mathematics, Aarhus University, Denmark
Editor
Mark A. Jensen ORCID
Tags
phase-type distributions population genetics ancestral process coalescent theory

GitHub Events

Total
Last Year

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 377
  • Total Committers: 5
  • Avg Commits per committer: 75.4
  • Development Distribution Score (DDS): 0.194
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Iker i****6@g****m 304
Asger Hobolth a****3@u****k 26
colinguetemme c****e@l****r 23
Lars Nørvang Andersen a****3@u****k 23
larsnandersen l****a@m****k 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 8
  • Total pull requests: 4
  • Average time to close issues: 20 days
  • Average time to close pull requests: 1 minute
  • Total issue authors: 2
  • Total pull request authors: 1
  • Average comments per issue: 0.63
  • Average comments per pull request: 0.0
  • Merged pull requests: 4
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • rivasiker (4)
  • tkchafin (4)
Pull Request Authors
  • rivasiker (4)
Top Labels
Issue Labels
enhancement (1) documentation (1) help wanted (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 243 last-month
  • Total docker downloads: 21,613
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 5
  • Total maintainers: 1
cran.r-project.org: PhaseTypeR

General-Purpose Phase-Type Functions

  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 243 Last month
  • Docker Downloads: 21,613
Rankings
Forks count: 21.9%
Stargazers count: 26.2%
Dependent packages count: 29.8%
Average: 35.0%
Dependent repos count: 35.5%
Downloads: 61.9%
Maintainers (1)
Last synced: 4 months ago

Dependencies

DESCRIPTION cran
  • expm * imports
  • igraph * imports
  • methods * imports
  • knitr * suggests
  • partitions * suggests
  • rmarkdown * suggests
  • testthat * suggests
.github/workflows/check-standard.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/draft-pdf.yml actions
  • actions/checkout v2 composite
  • actions/upload-artifact v1 composite
  • openjournals/openjournals-draft-action master composite
.github/workflows/pkgdown.yaml actions
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • r-lib/actions/setup-pandoc v1 composite
  • r-lib/actions/setup-r v1 composite
.github/workflows/pr-commands.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/pr-fetch v1 composite
  • r-lib/actions/pr-push v1 composite
  • r-lib/actions/setup-r v1 composite
.github/workflows/test-coverage.yaml actions
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • r-lib/actions/setup-pandoc v1 composite
  • r-lib/actions/setup-r v1 composite