Coder Social home page Coder Social logo

paretoconv's Introduction

Build Status Build status codecov Project Status: WIP CRAN_Status_Badge

paretoconv

An R package to calculate the n-fold convolution of Pareto distributions. f(x)=a x1-a, for x>0, a>1 using the techniques devised by Colin Ramsay in

  1. ‘The Distribution of Sums of Certain I.I.D. Pareto Variates’ (Communications in Statistics - Theory and Methods 35:395-405, 2006); and

  2. ‘The Distribution of Sums of I.I.D. Pareto Random Variables with Arbitrary Shape Parameter’ (Communications in Statistics - Theory and Methods 37:2177-2184, 2008).

The package contains only one function:

paretoconv (x, a, n, cdf=FALSE)

where n specifies the number of convolutions. Both this and a must be single-valued, while x can be a vector. cdf generates the cumulative distribution function, otherwise the probability density function is returned.


Installation

paretoconv is not (yet) on CRAN, and can be installed with any of the following options:

remotes::install_git("https://git.sr.ht/~mpadge/paretoconv")
remotes::install_bitbucket("mpadge/paretoconv")
remotes::install_gitlab("mpadge/paretoconv")
remotes::install_github("mpadge/paretoconv")

Example

Solid lines in the figure below are a reproduction of Ramsay’s (2006) Figure 2 of probability density functions for the first 5 convolutions of the Pareto pdf with shape parameter of a=5. Dashed lines are analogous values for the non-integer value of a=4.5.

x <- 1:50 / 10
n <- 1:5
yint <- lapply (n, function (i) paretoconv (x=x, a=5, n=i))
ynon <- lapply (n, function (i) paretoconv (x=x, a=4.5, n=i))
cols <- rainbow (length (n))
plot (NULL, NULL, xlim=range (x), ylim=range (yint, na.rm=TRUE), xlab='x', ylab='p')
for (i in n) {
    lines (x, yint [[i]], col=cols [i])
    lines (x, ynon [[i]], col=cols [i], lty=2)
}
legend ('topright', lwd=1, col=cols, bty='n', 
        legend=sapply (seq (n), function (i) paste0 ('n=', i)))

paretoconv's People

Contributors

mpadge avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

paretoconv's Issues

Implement asymptotic convergence

Estimate values for large x by examining the adaptIntegrate results for lower values of x and determining point of convergence to the distributional tail (according to a specified tolerance). For points beyond this point of convergence, replace adaptIntegrate values by direct power-law values.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.