Skip to content

Fix haddock for negativeBinomial, remove references to original bos repo #217

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

Merged
merged 3 commits into from
Apr 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,11 @@ optimisation.
# Get involved!

Please report bugs via the
[github issue tracker](https://github.com/bos/statistics/issues).
[github issue tracker](https://github.com/haskell/statistics/issues).

Master [git mirror](https://github.com/bos/statistics):

* `git clone git://github.com/bos/statistics.git`

There's also a [Mercurial mirror](https://bitbucket.org/bos/statistics):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This gives me 404 repository not found


* `hg clone https://bitbucket.org/bos/statistics`

(You can create and contribute changes using either Mercurial or git.)
Master [git mirror](https://github.com/haskell/statistics):

* `git clone git://github.com/haskell/statistics.git`

# Authors

Expand Down
8 changes: 4 additions & 4 deletions Statistics/Distribution/NegativeBinomial.hs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import Statistics.Internal
gChoose :: Double -> Int -> Double
gChoose n k
| k < 0 = 0
| k' >= 50 = exp $ logChooseFast n k'
| k' >= 50 = exp $ logChooseFast n k'
| otherwise = foldl' (*) 1 factors
where factors = [ (n - k' + j) / j | j <- [1..k'] ]
k' = fromIntegral k
Expand Down Expand Up @@ -151,7 +151,7 @@ complCumulative (NBD r p) x
| k < 0 = 1
| otherwise = incompleteBeta (fromIntegral (k+1)) r (1 - p)
where
k = (floor x)::Integer
k = floor x :: Integer
Copy link
Contributor Author

@jhrcek jhrcek Apr 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just an hlint warning fix here. Note that k = floor x :: Integer is already used on line 145 above, so this makes the code a bit more consistent.


mean :: NegativeBinomialDistribution -> Double
mean (NBD r p) = r * (1 - p)/p
Expand All @@ -166,14 +166,14 @@ directEntropy d =
dropWhile (>= -m_epsilon) $
[ let x = probability d k in x * log x | k <- [0..]]

-- | Construct negative binomial distribution. Number of failures /r/
-- | Construct negative binomial distribution. Number of successes /r/
Copy link
Contributor Author

@jhrcek jhrcek Apr 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This got me really confused because it's in conflict with the -- ^ Number of successes. on the lines below.

This is even more confusing, because the "output" of the distribution is probability of number of failures before we get r-th success.
But here, r is the (input) parameter of the distribution representing the number of successes that need to occur overall.

-- must be positive and probability must be in (0,1] range
negativeBinomial :: Double -- ^ Number of successes.
-> Double -- ^ Success probability.
-> NegativeBinomialDistribution
negativeBinomial r p = maybe (error $ errMsg r p) id $ negativeBinomialE r p

-- | Construct negative binomial distribution. Number of failures /r/
-- | Construct negative binomial distribution. Number of successes /r/
-- must be positive and probability must be in (0,1] range
negativeBinomialE :: Double -- ^ Number of successes.
-> Double -- ^ Success probability.
Expand Down
6 changes: 3 additions & 3 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@

* Computation of CDF and quantiles of Cauchy distribution is now numerically
stable.

* Fix loss of precision in computing of CDF of gamma distribution

* Log-normal and Weibull distributions added.

* `DiscreteGen` instance added for `DiscreteUniform`


Expand Down Expand Up @@ -130,7 +130,7 @@
## Changes in 0.14.0.0

Breaking update. It seriously changes parts of API. It adds new data types for
dealing with with estimates, confidence intervals, confidence levels and
dealing with estimates, confidence intervals, confidence levels and
p-value. Also API for statistical tests is changed.

* Module `Statistis.Types` now contains new data types for estimates,
Expand Down
4 changes: 2 additions & 2 deletions dense-linear-algebra/dense-linear-algebra.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ library
Statistics.Matrix.Types
build-depends: base >= 4.5 && < 5
, deepseq >= 1.1.0.2
, math-functions >= 0.1.7
, math-functions >= 0.1.7
, primitive >= 0.3
, vector >= 0.10
, vector-algorithms >= 0.4
Expand All @@ -58,4 +58,4 @@ test-suite spec

source-repository head
type: git
location: https://github.com/bos/statistics
location: https://github.com/haskell/statistics
4 changes: 3 additions & 1 deletion statistics.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@ category: Math, Statistics

extra-source-files:
README.markdown
changelog.md
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing cabal check warning:

Warning: [doc-place] Please consider moving the file 'changelog.md' from the
'extra-source-files' section of the .cabal file to the section
'extra-doc-files'.

examples/kde/KDE.hs
examples/kde/data/faithful.csv
examples/kde/kde.html
examples/kde/kde.tpl
tests/utils/Makefile
tests/utils/fftw.c

extra-doc-files:
changelog.md

tested-with:
GHC ==8.4.4
|| ==8.6.5
Expand Down
2 changes: 1 addition & 1 deletion tests/Tests/Distribution.hs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ instance Param StudentT where
quantileIsInvCDF_enabled _ = False

instance Param BetaDistribution where
-- FIXME: See https://github.com/bos/statistics/issues/161 for details
-- FIXME: See https://github.com/haskell/statistics/issues/161 for details
quantileIsInvCDF_enabled _ = False

instance Param FDistribution where
Expand Down