{"id":16499281,"url":"https://github.com/mschauer/pointprocessinference.jl","last_synced_at":"2025-10-13T22:12:20.517Z","repository":{"id":55635289,"uuid":"173130349","full_name":"mschauer/PointProcessInference.jl","owner":"mschauer","description":"Statistical inference for Poisson Processes","archived":false,"fork":false,"pushed_at":"2020-12-16T12:28:20.000Z","size":2038,"stargazers_count":7,"open_issues_count":3,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-13T21:42:56.055Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Julia","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mschauer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-28T14:49:27.000Z","updated_at":"2023-02-16T10:07:51.000Z","dependencies_parsed_at":"2022-08-15T05:01:03.877Z","dependency_job_id":null,"html_url":"https://github.com/mschauer/PointProcessInference.jl","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/mschauer/PointProcessInference.jl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mschauer%2FPointProcessInference.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mschauer%2FPointProcessInference.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mschauer%2FPointProcessInference.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mschauer%2FPointProcessInference.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mschauer","download_url":"https://codeload.github.com/mschauer/PointProcessInference.jl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mschauer%2FPointProcessInference.jl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279017157,"owners_count":26085983,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T14:51:50.510Z","updated_at":"2025-10-13T22:12:20.499Z","avatar_url":"https://github.com/mschauer.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"[pkgeval-img]: https://juliaci.github.io/NanosoldierReports/pkgeval_badges/P/PointProcessInference.svg\n[pkgeval-url]: https://juliaci.github.io/NanosoldierReports/pkgeval_badges/report.html\n\n[![][pkgeval-img]][pkgeval-url]\n[![Build Status](https://travis-ci.org/mschauer/PointProcessInference.jl.svg?branch=master)](https://travis-ci.org/mschauer/PointProcessInference.jl)\n\n# PointProcessInference.jl\nFast and scalable non-parametric Bayesian inference for Poisson point processes\n\n## Introduction\n\nPoisson point processes are among the basic modelling tools in many areas. Their probabilistic properties are determined by their intensity function, the density *λ*.\nThis Julia package implements our non-parametric Bayesian approach to estimation of the intensity function *λ* for univariate Poisson point processes. For full details see our preprint\n\n-  S. Gugushvili, M. Schauer, F. van der Meulen, and P. Spreij. Fast and scalable non-parametric Bayesian inference for Poisson point processes. __[arXiv:1804.03616 [stat.ME]](https://arxiv.org/abs/1804.03616)__, 2018.\n\nIntuitively, a univariate Poisson point processes *X*, also called a non-homogeneous Poisson process, can be thought of as random\nscattering of points in the time interval *[0,T]*, where the way the scattering occurs is determined by the intensity function *λ*.\nAn example is the ordinary Poisson process, for which the intensity *λ*  is constant.\n\n## Methodology\n\nWe infer the intensity function *λ* in a non-parametric fashion. The function *λ* is a priori modelled as piecewise constant. This is even more natural, if the data have been already binned,\nas is often the case in, e.g., astronomy. Thus, fix a positive integer *N* and a grid *b* of points `b[1] == 0`, `b[N] == T` on the interval *[0,T]*, for instance a uniform grid.\nThe intensity *λ* is then modelled as\n`λ(x) = ψ[k]` for `b[k] \u003c= x \u003c b[k+1]`.\n\nNow we postulate that a priori the coefficients *ψ* form a Gamma Markov chain (GMC). As explained in our preprint, this prior induces smoothing across the coefficients *ψ*, and leads to conjugate posterior computations\nvia the Gibbs sampler. The data-generating intensity is not assumed to be necessarily piecewise constant. Our methodology provides both a point estimate of the intensity function (posterior mean) and uncertainty quantification via marginal credible bands; see the examples below.\n\n## Installation\n\nChange julia into the package manager mode by hitting `]`. Then run the command `add  PointProcessInference`.\n\n```\npkg\u003e add PointProcessInference\n```\n\n\n## Usage\n\nIn the following example we load the UK coal mining disasters data and\nperforms its statistical analysis via the Poisson point process.\n\n\n```\nusing PointProcessInference\nusing Random\n\nRandom.seed!(1234) # set RNG\n\nobservations, parameters, λinfo = PointProcessInference.loadexample(\"coal\")\n\nres = PointProcessInference.inference(observations; parameters...)\n```\n\nThe main procedure has signature\n\n```julia\n PointProcessInference.inference(observations; title = \"Poisson process\", T = 1.0, n = 1, ...)\n```\n\nwhere `observations` is the sorted vector of Poisson event times, `T` is the endpoint of the time interval considered, and if\n`observations` is an aggregate of `n` different independent observations (say aggregated for `n` days), this can be indicated by the parameter `n \u003e 1`. A full list of parameters is as follows:\n\n```julia\nfunction inference(observations;\n    title = \"Poisson process\", # optional caption for mcmc run\n    summaryfile = nothing, # path to summary file or nothing\n    T0 = 0.0, # start time\n    T = maximum(observations), # end time\n    n = 1, # number of aggregated samples in `observations`\n    N = min(length(observations)÷4, 50), # number of bins\n    samples = 1:1:30000, # run for `i in 1:last(samples)` iterations, save coefficients if `i ∈ samples`\n    α1 = 0.1, β1 = 0.1, # parameters for Gamma Markov chain\n    Π = Exponential(10), # prior on alpha\n    τ = 0.7, # Set scale for random walk update on log(α)\n    αind = 0.1, βind = 0.1, # parameters for the independent Gamma prior\n    emp_bayes = false, # estimate βind using empirical Bayes\n    verbose = true\n)\n```\n\nIterates of *ψ* are the rows of the matrix\n```julia\nres.ψ\n```\n\n## High-quality plots\n\nFor high quality plotting, the package has a script `process-output-simple.jl` that visualizes\nthe results with the help of `R` and `ggplot2`.\nAfter installing the additional dependencies\n```\npkg\u003e add RCall\npkg\u003e add DataFrames\n```\ninclude the script (it is located in the `contrib` folder, the location can be retrieved by calling `PointProcessInference.plotscript()`)\n```\ninclude(PointProcessInference.plotscript())\nplotposterior(res)\n```\n\nThe script starts `ggplot2` with `RCall`, and `plotposterior` expects as its argument the result `res` returned from `inference`. For computing the posterior summary measures, the first half of the MCMC iterates is treated as burnin samples.\n\n## Example 1\n\nHere, we generate data from a nonhomogeneous Poissson process as follows:\n```julia\nλ0(x) =  (20 + 8*cos(x))\nλ0max = 28\nobs = PointProcessInference.samplepoisson(λ0, λ0max, 0, 10)\n```\n\nThe nonparametric estimator is obtained by running\n```julia\nres = PointProcessInference.inference(obs)\n```\nFinally, a default graph is obtained by\n```julia\ninclude(PointProcessInference.plotscript())\nplotposterior(res)\n```\n\n\u003cimg src=\"https://raw.githubusercontent.com/mschauer/PointProcessInference.jl/master/assets/basicexample1.png\" alt=\"Intensity estimate for example 1.\" width=\"67%\"\u003e\n\n* Illustration: Intensity estimation for the generated data in example 1. The data are displayed via the rug plot in the upper margin of the plot, the posterior mean is given by a solid black line, while a 95% marginal credible band is shaded in light blue.\n\nA slightly refined plot, where the true intensity is added to the figure can be obtained by passing the data-generating intensity function as an extra argument.\n```julia\nplotposterior(res;figtitle=\"Cosine intensity\", λ=λ0)\n```\nThis results in the plot\n\n\u003cimg src=\"https://raw.githubusercontent.com/mschauer/PointProcessInference.jl/master/assets/basicexample2.png\" alt=\"Intensity estimate for example 1.\" width=\"67%\"\u003e\n\n## Example 2\n\nHere, we analyse the well-known coal mining disasters data set.\n```julia\nobservations, parameters, λinfo = PointProcessInference.loadexample(\"coal\")\nres = PointProcessInference.inference(observations)\nplotposterior(res)\n```\n\n\u003cimg src=\"https://raw.githubusercontent.com/mschauer/PointProcessInference.jl/master/assets/coal1.png\" alt=\"Intensity estimate for example 2.\" width=\"67%\"\u003e\n\n* Illustration: Intensity estimation for the UK coal mining disasters data (1851-1962). The data are displayed via the rug plot in the upper margin of the plot, the posterior mean is given by a solid black line, while a 95% marginal credible band is shaded in light blue.\n\nThe horizontal tickmarks can be adjusted, as the offset date of the data, which is March 15, 1851 in this case.\n```julia\nstart = 1851+(28+31+15)/365\nplotposterior(res; figtitle=\"Coal mining disasters\", offset = start,hortics=1850:10:1960)\n```\n\n\u003cimg src=\"https://raw.githubusercontent.com/mschauer/PointProcessInference.jl/master/assets/coal2.png\" alt=\"Intensity estimate for example 2.\" width=\"67%\"\u003e\n\n## Citing the package\n\nIf you use the package in your work, we encourage you to cite it using the following BibTeX code:\n\n```\n@misc{pppjl,\n\ttitle = { {PointProcessInference 0.1.0 -- Code and Julia package accompanying the article ``Gugushvili, van der Meulen, Schauer, Spreij (2018): Fast and scalable non-parametric Bayesian inference for Poisson point processes\" ({http://arxiv.org/abs/1804.03616})} },\n\tauthor = {Gugushvili, Shota and van der Meulen, Frank and Schauer, Moritz and Spreij, Peter},\n\tyear = {2019},\n\tdoi = {10.5281/zenodo.2591395},\n\turl = {https://doi.org/10.5281/zenodo.2591395},\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmschauer%2Fpointprocessinference.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmschauer%2Fpointprocessinference.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmschauer%2Fpointprocessinference.jl/lists"}