Giter Site home page Giter Site logo

betaregression.jl's People

Contributors

ararslan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

palday jmmanley

betaregression.jl's Issues

Convergence failures where R betareg succeeds

Convergence can fail for models of the form y ~ 1 when y is a random sample from one of the following beta distributions. In each case, the cause of convergence failure has to do with the precision estimate. The particular failure mode regarding the precision is included.

  • Beta(0.5, 0.5): Initial estimate from initialize! is invalid (EDIT: Fixed by #4)
  • Beta(0.2, 0.2): Estimate becomes negative during fitting
  • Beta(0.5, 10): Estimate becomes negative during fitting
  • Beta(10, 0.3): Estimate becomes negative during fitting

For invalid initialization of the precision, we can follow suit with the R package betareg and set the starting value to 1 (see #4). Doing so allows this model to be fit, and the estimates obtained match those obtained from betareg.

The negative precision currently causes an issue in weightdiag due to what seemed like an obvious simplification at the time (but in retrospect is obviously incorrect): the simplification assumes sqrt(ϕ^2) == ϕ, which is only true if ϕ ≥ 0. (In my defense, ϕ is supposed to be positive!) Undoing this simplification causes fitting to throw a ConvergenceException from fit rather than a DomainError from sqrt.

However, betareg actually succeeds in fitting these models on the same data. My very scientific means of determining this:

y = rand(Beta(0.2, 0.2), 10)
fit(BetaRegressionModel, ones(10, 1), y)
clipboard(strip(sprint(show, y), ['[', ']']))
betareg(y ~ 1, data.frame(y=c(...)), link="logit", link.phi="identity", type="ML")

where ... is the contents of my clipboard.

The betareg documentation notes that fitting is performed using R's optim with the default method set to BFGS. Fitting in this package is performed by Fisher scoring (i.e. Newton's method). I'm not sure what effect that difference could have in practice but it's worth noting.

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Implement user-defined weights

Some stubs are currently in place but we deliberately throw an error when weights are actually specified. The Ferrari 2004 paper makes no mention of weights and I haven't yet bothered to work out the math myself. Off the top of my head, I think what's needed is to account for it in the linear predictor updates, score vector, and expected Fisher information.

Looking at the R documentation for betareg, it appears they only accept case weights. It would likely be easiest to follow suit and use FrequencyWeights from StatsBase (and just wrap any plain input vector with that type). That makes testing against output from R easier.

I almost surely won't block an initial package release on having this feature.

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.