Giter VIP home page Giter VIP logo

hurdle_ordered's Introduction

hurdle_ordered

This is a function to run a hurdle ordinal model. "Don't knows" are modeled using a bernoulli distribution, while the ordinal scale is modeled as ordinal.

This is still in development, so it may or may not work well. Use at your own risk.

files

There are three main files that matter:

  • helper_functions_from_brms.R contains a bunch of helper functions pulled from brms. These are necessary to run the posterior predictive checks, loo, etc.
  • hurdle_ordered_function.R contains the functions needed to run the model and for post-processing.
  • test with data.R contains some simulated data and runs the model. The model works, but needs more tests

Important!!

  • The formula must be wrapped in bf().
  • Priors must be manually set for hu. I intend to eventually set default priors, once I figure out a way to do it properly.
  • bf(y | thres(num_thres, group) ~ ...) doesn't work. I need to figure out how to properly specify the grouping structure and update the brms model.
  • Thresholds are set to be flexible. Other options don't work at the moment.
  • Where possible, set the "Don't knows" to be one leve higher than the ordinal scale. This makes it easier to visualize the posterior predictive checks. If you don't care what they look like, set "Don't know" to whatever you want.
  • Use at your own risk

Credit where credit is due

  • Check out the Stan version and brms version by Octavio Medina
  • The function to fit the brms model, extract and edit the Stan code, run the cmdstanr model, and put the results back in the brmsfit object comes from @ajnafa.

Good luck. Comments and suggestions (and PRs...) welcome.

hurdle_ordered's People

Contributors

sjwild avatar

Stargazers

Staffan Betnér avatar  avatar Gonzalo García-Castro avatar Brenton M. Wiernik avatar

Watchers

 avatar

Forkers

bwiernik

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.