Code Monkey home page Code Monkey logo

davies's Introduction

The Davies distribution

CRAN_Status_Badge

Overview

The Davies distribution is a flexible family of distributions for non-negative observations; it is particularly suitable for right-skewed data. Hankin and Lee (2006) set out mathematical properties of the Davies distribution and the Davies package is showcased here. It is defined in terms of its quantile function

Q(p;c,\lambda_1,\lambda_2) = \frac{Cp^{\lambda_1}}{(1-p)^{\lambda_2}}

We may sample from this distribution using rdavies():

params <- c(2,0.1,0.1)
rdavies(10,params)
#>  [1] 1.761097 2.008966 1.767981 2.020754 1.674392 2.003635 1.485477 1.980971
#>  [9] 2.253223 2.567022

Moments are given by E(X^k)=C^kB\left(1+k\lambda_1,1-k\lambda_2\right) where B is the beta function. In the package this is given by M(), which is a convenience wraper for davies.moment(). Numerical verification for the second (non-central) moment:

c(mean(rdavies(1e6,params)^2),M(2,params))
#> [1] 4.273915 4.275837

Estimation

The least-squares technique described in Hankin and Lee 2006 is not implemented, but the package implements a maximum-likelihood estimate:

x <- rdavies(80,params)
p_estimate <- maximum.likelihood(x)
p_true <- params
p_estimate
#> [1] 1.95306332 0.08418046 0.11483549
(bias <- p_estimate - p_true)
#> [1] -0.04693668 -0.01581954  0.01483549

Reference

Robin K. S. Hankin and Alan Lee 2006. “A new family of non-negative distributions”. Aust. N. Z. J. Stat, 48(1):67-78

davies's People

Contributors

robinhankin avatar

Watchers

James Cloos avatar  avatar

davies's Issues

rstupid()

The "stupid" distribution documented at rstupid.Rd should include functionality to calculate the quantile, density, and distribution functions qstupid() etc.

CRAN names inconsistency

Kurt writes to me:

Dear maintainers,

This concerns the CRAN packages

AGHmatrix AdMit Davies EGAnet FORTLS IPCAPS LPStimeSeries
NetworkToolbox QTLRel R2HTML RFLPtools RandomFieldsUtils RcppCGAL
Rtwalk SemNeT SemNetCleaner SemNetDictionaries StreamMetabolism
[snip]

maintained by one of you:

[snip]
Riyan Cheng <[email protected]>: QTLRel
Robin K. S. Hankin <[email protected]>: Davies
Rodrigo Amadeu <[email protected]>: AGHmatrix
[snip]

These have inst/CITATION files with persons using the deprecated 'first'
or 'middle' arguments instead of 'given':

$It is recommended to use ‘given’ instead of ‘first’.\n
[1] "AGHmatrix" "Davies" "LPStimeSeries" "R2HTML"
[snip]

Can you please change to use 'given' instead?

Best
-k

ddavies() gives NaN

ddavies(seq(from=0,to=0.1,by=0.01),c(1,0.1,0.1))
 [1] 0.000000e+00 3.113553e-19          NaN 3.113553e-19 3.113553e-19
 [6]          NaN 3.113553e-19          NaN 3.113553e-19          NaN
[11] 4.388552e-06
>

package vs Hankin & Lee

Back in 2013, Michal Brzezinski wrote to me:

Dear Dr Hankin,

using your R package "Davies", I am able to replicate the results of your
paper written with Alan Lee on "A new family of non-negative
distributions" with respect to the x00m700p4 data set, but only using
maximum likelihood approach.
Using least squares approach gives me the following parameter values:
11.59207419  0.56175174  0.04580323,
which are significantly different from ML-based results:
8.3270082 0.3195465 0.1810743.
Is it my problem or maybe the package produces erroneous results using
least squares method?

He went on to say:

No, the numbers for LS and MLE results reported in your paper (p. 76) are
quite close, so I suspect that there may be a bug in the package.
Best wishes,

My reply:

you appear to be quite correct.  The Davies package has never been particularly well aligned
with the paper and IIRC the package included methods which we superceded when writing
the paper, but we never got round to updating the package.  I guess this is one of the
consequences.  I'll discuss with Alan and get back to you.

. . . but I never did get back to him.

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.