Code Monkey home page Code Monkey logo

latentgaussianmixturemodel.jl's Introduction

LatentGaussianMixtureModel

The Julia package for Generalized Linear Mixed Model with Normal Mixture random effects. It is named as LatentGaussianMixtureModel because we are fitting a Gaussian Mixture Model on the random effect which is latent.

To install this package, please run

Pkg.clone("https://github.com/panlanfeng/LatentGaussianMixtureModel.jl.git")

To update to a new version, just run

Pkg.update()

Currently this package only support single random effect on intercept with logistic link. The easiest way to use is constructing a LGMModel object via the following

using DataFrames
using LatentGaussianMixtureModel
df = readtable("data.csv")
#fit a two components mixture
m = latentgmm(Y~x1+x2+x3+(1|groupindex), df, 2)

#or
X = readcsv("X.csv");
Y=readcsv("Y.csv");
groupindex = readcsv("groupindex.csv");
m = LGMModel(X, Y, groupindex, 2)

and then fit the model via the function fit!

fit!(m)

The estimated parameters can accessed by

m.p, m.μ, m.σ, m.β

To do the restricted likelihood ratio test on the number of components, use the EMtest function, for example

EMtest(m)

This will print out the test statistic and the p value.

See arguments available for constructing the LGMModel by running

?LGMModel

and see arguments for fit! by

?fit!

The LGMModel object is a subtype of RegressionModel and the following methods are available:

  • nobs returns the number of random effect levels
  • model_response returns the response Y
  • coef returns the fixed effects β
  • ranef! return the predict random effects
  • stderror gives the standard error of fixed effects
  • confint calculates the confidence interval
  • coeftable prints the fixed effects and their p values
  • loglikelihood calculates the log marginal likelihood
  • vcov returns the covariance matrix of fixed effects
  • asymptoticdistribution returns the simulated asymptotic distribution of the restricted likelihood ratio test
  • predict computes the probability of Y being 1 at given new data
  • FDR detect the "outstanding" random effects while controlling the False Discovery Rate.

For example,

coef(m)
coeftable(m)
loglikelihood(m)

latentgaussianmixturemodel.jl's People

Contributors

panlanfeng avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

pengrim dgyang77

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.