-
Notifications
You must be signed in to change notification settings - Fork 42
Remove Rmath sampling methods #188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
devmotion
wants to merge
2
commits into
master
Choose a base branch
from
dmw/rand
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,45 @@ | ||
| # functions related to hyper-geometric distribution | ||
|
|
||
| # R implementations | ||
| using .RFunctions: | ||
| hyperpdf, | ||
| hyperlogpdf, | ||
| hypercdf, | ||
| hyperccdf, | ||
| hyperlogcdf, | ||
| hyperlogccdf, | ||
| hyperinvcdf, | ||
| hyperinvccdf, | ||
| hyperinvlogcdf, | ||
| hyperinvlogccdf | ||
| # Rmath implementations | ||
| function hyperpdf(ms::Real, mf::Real, n::Real, x::Real) | ||
| T = float(Base.promote_typeof(ms, mf, n, x)) | ||
| return convert(T, Rmath.dhyper(x, ms, mf, n, false)) | ||
| end | ||
| function hyperlogpdf(ms::Real, mf::Real, n::Real, x::Real) | ||
| T = float(Base.promote_typeof(ms, mf, n, x)) | ||
| return convert(T, Rmath.dhyper(x, ms, mf, n, true)) | ||
| end | ||
|
|
||
| function hypercdf(ms::Real, mf::Real, n::Real, x::Real) | ||
| T = float(Base.promote_typeof(ms, mf, n, x)) | ||
| return convert(T, Rmath.phyper(x, ms, mf, n, true, false)) | ||
| end | ||
| function hyperccdf(ms::Real, mf::Real, n::Real, x::Real) | ||
| T = float(Base.promote_typeof(ms, mf, n, x)) | ||
| return convert(T, Rmath.phyper(x, ms, mf, n, false, false)) | ||
| end | ||
| function hyperlogcdf(ms::Real, mf::Real, n::Real, x::Real) | ||
| T = float(Base.promote_typeof(ms, mf, n, x)) | ||
| return convert(T, Rmath.phyper(x, ms, mf, n, true, true)) | ||
| end | ||
| function hyperlogccdf(ms::Real, mf::Real, n::Real, x::Real) | ||
| T = float(Base.promote_typeof(ms, mf, n, x)) | ||
| return convert(T, Rmath.phyper(x, ms, mf, n, false, true)) | ||
| end | ||
|
|
||
| function hyperinvcdf(ms::Real, mf::Real, n::Real, q::Real) | ||
| T = float(Base.promote_typeof(ms, mf, n, q)) | ||
| return convert(T, Rmath.qhyper(q, ms, mf, n, true, false)) | ||
| end | ||
| function hyperinvccdf(ms::Real, mf::Real, n::Real, q::Real) | ||
| T = float(Base.promote_typeof(ms, mf, n, q)) | ||
| return convert(T, Rmath.qhyper(q, ms, mf, n, false, false)) | ||
| end | ||
| function hyperinvlogcdf(ms::Real, mf::Real, n::Real, lq::Real) | ||
| T = float(Base.promote_typeof(ms, mf, n, lq)) | ||
| return convert(T, Rmath.qhyper(lq, ms, mf, n, true, true)) | ||
| end | ||
| function hyperinvlogccdf(ms::Real, mf::Real, n::Real, lq::Real) | ||
| T = float(Base.promote_typeof(ms, mf, n, lq)) | ||
| return convert(T, Rmath.qhyper(lq, ms, mf, n, false, true)) | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,45 @@ | ||
| # functions related to noncentral beta distribution | ||
|
|
||
| # R implementations | ||
| using .RFunctions: | ||
| nbetapdf, | ||
| nbetalogpdf, | ||
| nbetacdf, | ||
| nbetaccdf, | ||
| nbetalogcdf, | ||
| nbetalogccdf, | ||
| nbetainvcdf, | ||
| nbetainvccdf, | ||
| nbetainvlogcdf, | ||
| nbetainvlogccdf | ||
| # Rmath implementations | ||
| function nbetapdf(α::Real, β::Real, λ::Real, x::Real) | ||
| T = float(Base.promote_typeof(α, β, λ, x)) | ||
| return convert(T, Rmath.dnbeta(x, α, β, λ, false)) | ||
| end | ||
| function nbetalogpdf(α::Real, β::Real, λ::Real, x::Real) | ||
| T = float(Base.promote_typeof(α, β, λ, x)) | ||
| return convert(T, Rmath.dnbeta(x, α, β, λ, true)) | ||
| end | ||
|
|
||
| function nbetacdf(α::Real, β::Real, λ::Real, x::Real) | ||
| T = float(Base.promote_typeof(α, β, λ, x)) | ||
| return convert(T, Rmath.pnbeta(x, α, β, λ, true, false)) | ||
| end | ||
| function nbetaccdf(α::Real, β::Real, λ::Real, x::Real) | ||
| T = float(Base.promote_typeof(α, β, λ, x)) | ||
| return convert(T, Rmath.pnbeta(x, α, β, λ, false, false)) | ||
| end | ||
| function nbetalogcdf(α::Real, β::Real, λ::Real, x::Real) | ||
| T = float(Base.promote_typeof(α, β, λ, x)) | ||
| return convert(T, Rmath.pnbeta(x, α, β, λ, true, true)) | ||
| end | ||
| function nbetalogccdf(α::Real, β::Real, λ::Real, x::Real) | ||
| T = float(Base.promote_typeof(α, β, λ, x)) | ||
| return convert(T, Rmath.pnbeta(x, α, β, λ, false, true)) | ||
| end | ||
|
|
||
| function nbetainvcdf(α::Real, β::Real, λ::Real, q::Real) | ||
| T = float(Base.promote_typeof(α, β, λ, q)) | ||
| return convert(T, Rmath.qnbeta(q, α, β, λ, true, false)) | ||
| end | ||
| function nbetainvccdf(α::Real, β::Real, λ::Real, q::Real) | ||
| T = float(Base.promote_typeof(α, β, λ, q)) | ||
| return convert(T, Rmath.qnbeta(q, α, β, λ, false, false)) | ||
| end | ||
| function nbetainvlogcdf(α::Real, β::Real, λ::Real, lq::Real) | ||
| T = float(Base.promote_typeof(α, β, λ, lq)) | ||
| return convert(T, Rmath.qnbeta(lq, α, β, λ, true, true)) | ||
| end | ||
| function nbetainvlogccdf(α::Real, β::Real, λ::Real, lq::Real) | ||
| T = float(Base.promote_typeof(α, β, λ, lq)) | ||
| return convert(T, Rmath.qnbeta(lq, α, β, λ, false, true)) | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,45 @@ | ||
| # functions related to negative binomial distribution | ||
|
|
||
| # R implementations | ||
| using .RFunctions: | ||
| nbinompdf, | ||
| nbinomlogpdf, | ||
| nbinomcdf, | ||
| nbinomccdf, | ||
| nbinomlogcdf, | ||
| nbinomlogccdf, | ||
| nbinominvcdf, | ||
| nbinominvccdf, | ||
| nbinominvlogcdf, | ||
| nbinominvlogccdf | ||
| # Rmath implementations | ||
| function nbinompdf(r::Real, p::Real, x::Real) | ||
| T = float(Base.promote_typeof(r, p, x)) | ||
| return convert(T, Rmath.dnbinom(x, r, p, false)) | ||
| end | ||
| function nbinomlogpdf(r::Real, p::Real, x::Real) | ||
| T = float(Base.promote_typeof(r, p, x)) | ||
| return convert(T, Rmath.dnbinom(x, r, p, true)) | ||
| end | ||
|
|
||
| function nbinomcdf(r::Real, p::Real, x::Real) | ||
| T = float(Base.promote_typeof(r, p, x)) | ||
| return convert(T, Rmath.pnbinom(x, r, p, true, false)) | ||
| end | ||
| function nbinomccdf(r::Real, p::Real, x::Real) | ||
| T = float(Base.promote_typeof(r, p, x)) | ||
| return convert(T, Rmath.pnbinom(x, r, p, false, false)) | ||
| end | ||
| function nbinomlogcdf(r::Real, p::Real, x::Real) | ||
| T = float(Base.promote_typeof(r, p, x)) | ||
| return convert(T, Rmath.pnbinom(x, r, p, true, true)) | ||
| end | ||
| function nbinomlogccdf(r::Real, p::Real, x::Real) | ||
| T = float(Base.promote_typeof(r, p, x)) | ||
| return convert(T, Rmath.pnbinom(x, r, p, false, true)) | ||
| end | ||
|
|
||
| function nbinominvcdf(r::Real, p::Real, q::Real) | ||
| T = float(Base.promote_typeof(r, p, q)) | ||
| return convert(T, Rmath.qnbinom(q, r, p, true, false)) | ||
| end | ||
| function nbinominvccdf(r::Real, p::Real, q::Real) | ||
| T = float(Base.promote_typeof(r, p, q)) | ||
| return convert(T, Rmath.qnbinom(q, r, p, false, false)) | ||
| end | ||
| function nbinominvlogcdf(r::Real, p::Real, lq::Real) | ||
| T = float(Base.promote_typeof(r, p, lq)) | ||
| return convert(T, Rmath.qnbinom(lq, r, p, true, true)) | ||
| end | ||
| function nbinominvlogccdf(r::Real, p::Real, lq::Real) | ||
| T = float(Base.promote_typeof(r, p, lq)) | ||
| return convert(T, Rmath.qnbinom(lq, r, p, false, true)) | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,45 @@ | ||
| # functions related to noncentral chi-square distribution | ||
|
|
||
| # R implementations | ||
| using .RFunctions: | ||
| nchisqpdf, | ||
| nchisqlogpdf, | ||
| nchisqcdf, | ||
| nchisqccdf, | ||
| nchisqlogcdf, | ||
| nchisqlogccdf, | ||
| nchisqinvcdf, | ||
| nchisqinvccdf, | ||
| nchisqinvlogcdf, | ||
| nchisqinvlogccdf | ||
| # Rmath implementations | ||
| function nchisqpdf(k::Real, λ::Real, x::Real) | ||
| T = float(Base.promote_typeof(k, λ, x)) | ||
| return convert(T, Rmath.dnchisq(x, k, λ, false)) | ||
| end | ||
| function nchisqlogpdf(k::Real, λ::Real, x::Real) | ||
| T = float(Base.promote_typeof(k, λ, x)) | ||
| return convert(T, Rmath.dnchisq(x, k, λ, true)) | ||
| end | ||
|
|
||
| function nchisqcdf(k::Real, λ::Real, x::Real) | ||
| T = float(Base.promote_typeof(k, λ, x)) | ||
| return convert(T, Rmath.pnchisq(x, k, λ, true, false)) | ||
| end | ||
| function nchisqccdf(k::Real, λ::Real, x::Real) | ||
| T = float(Base.promote_typeof(k, λ, x)) | ||
| return convert(T, Rmath.pnchisq(x, k, λ, false, false)) | ||
| end | ||
| function nchisqlogcdf(k::Real, λ::Real, x::Real) | ||
| T = float(Base.promote_typeof(k, λ, x)) | ||
| return convert(T, Rmath.pnchisq(x, k, λ, true, true)) | ||
| end | ||
| function nchisqlogccdf(k::Real, λ::Real, x::Real) | ||
| T = float(Base.promote_typeof(k, λ, x)) | ||
| return convert(T, Rmath.pnchisq(x, k, λ, false, true)) | ||
| end | ||
|
|
||
| function nchisqinvcdf(k::Real, λ::Real, q::Real) | ||
| T = float(Base.promote_typeof(k, λ, q)) | ||
| return convert(T, Rmath.qnchisq(q, k, λ, true, false)) | ||
| end | ||
| function nchisqinvccdf(k::Real, λ::Real, q::Real) | ||
| T = float(Base.promote_typeof(k, λ, q)) | ||
| return convert(T, Rmath.qnchisq(q, k, λ, false, false)) | ||
| end | ||
| function nchisqinvlogcdf(k::Real, λ::Real, lq::Real) | ||
| T = float(Base.promote_typeof(k, λ, lq)) | ||
| return convert(T, Rmath.qnchisq(lq, k, λ, true, true)) | ||
| end | ||
| function nchisqinvlogccdf(k::Real, λ::Real, lq::Real) | ||
| T = float(Base.promote_typeof(k, λ, lq)) | ||
| return convert(T, Rmath.qnchisq(lq, k, λ, false, true)) | ||
| end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR is technically non-breaking (since the removed functions are not public API) but in practice breaks old versions of Distributions that make use of these non-public functions.