Git Product home page Git Product logo

betabinglm's Introduction

BetabinGLM: Beta-binomial regression model

Installation

You can install from this GitHub repository for the latest (often development) version by following the command line.

pip install -U git+https://github.com/StatBiomed/BetabinGLM

In either case, add --user if you don't have write permission for your Python environment.

Quick start

from BetabinGLM import betabin

model = betabin(x, y, fit_intercept = True, method = "SLSQP")

Where x is an array of n * w dimensions, y is an array of n * 2 dimensions. n is the sample size, w is the number of independent variables. The columns 1 and 2 of y represent the numbers of positive and negative observation respectively.

Constants for intercept are added by default. For optimization, this package supports all methods in sp.optimize.minimize. SLSQP is used by default.

To obtain the Log-Likelihood:

model.LL

Try testing a few samples, if it doesn't provide a satisfying result: 1) errors occured (e.g. the initialization using binomial regression encounters a nan value problem) 2) Provides unaccurate result (e.g. returns a groups of 0 in parameters or provides a very small log-likelihood compared with the one gotten from the method below), then consider the ways listed below would be practicable. Otherwise, keep using this one as it works faster.

from BetabinGLM import BetaBinomial

model = BetaBinomial(x, y, fit_intercept = True, method = "Nelder-Mead")

This package is similar to the betabin mentioned above expect using a different way to initialize and calling scipy.optimize.minimize several times during optimization. Also, Nelder-Mead is used by default, instead of SLSQP. Try this one if the 'betabin' can't offer a sactisfying result.

from BetabinGLM import BetaBinomialAlternative

model = BetaBinomialAlternative(x, y, fit_intercept = True, method = "Nelder-Mead")

This package is very similar to the BetaBinomial mentioned above. Try this one if the data contains various variables (e.g. the number of variables > 15) since this one works faster while the accuracy are similar to the 'BetaBinomial'.

Related links

This package is an achievement by a group of summer interns through a hackathon project:

betabinglm's People

Contributors

amyhyy avatar grace00821 avatar hoimanc avatar huangyh09 avatar liu-jinhui avatar

Watchers

 avatar  avatar  avatar

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.