Coder Social home page Coder Social logo

m-clark / miscellaneous-r-code Goto Github PK

View Code? Open in Web Editor NEW
189.0 22.0 81.0 11.49 MB

Code that might be useful to others for learning/demonstration purposes, specifically along the lines of modeling and various algorithms. **Superseded by the models-by-example repo**.

R 77.49% MATLAB 1.07% Julia 1.22% Python 3.22% Stan 14.51% CSS 0.22% Rebol 0.17% Jupyter Notebook 2.10%
r stan jags matlab julia python bayesian mixed-models gaussian-processes factor-analysis

miscellaneous-r-code's Introduction

Lifecycle Status

Miscellaneous (mostly) R Code

NOTE: Many of the models and algorithms in this REPO have been updated and now live in a a more organized document. Most of the code that carries over (the bulk of the files in /ModelFitting) has been upgraded, so refer to the document instead of these files, even if they have been relatively recently revised. Though I started updating these initially, all subsequent work went to the document, so it should now be your point of reference.

However, only a handful of Bayesian demos are going to be included in that document, as the Stan code is pretty dated at this point, and most of the functionality demonstrated now exists in rstanarm/brms, whose functionality allows one to inspect the model code. I will still likely transfer some that may be more unique/useful to the document.

The document still has some kinks to work out and some additions incoming, but can be found here. The updated code there will be more 'tidy' and conform to more widely used coding standards, which was the goal of the code here anyway. More can be found at my website.


This is a place for miscellaneous R and other code I've put together for clients, co-workers or myself for learning and demonstration purposes. The attempt is made to put together some well-commented and/or conceptually clear code from scratch, though most functionality is readily available in any number of well-developed R packages. Typically, examples are provided using such packages for comparison of results. I would say most of these are geared toward intermediate to advanced folks that want to dig a little deeper into the models and underlying algorithms.

I also have documents of varying depth on a range of modeling and programming topics that can be found at my website.

Model Fitting

Code related to fitting of various models.

standard linear regression, standard logistic regression, penalized regression, lasso regression, ridge regression, newton and IRLS, nelder-mead (Python) (R), gradient descent (stochastic), one factor random effects (R) (Julia) (Matlab), two factor random effects (R) (Julia) (Matlab), mixed model via ML, bivariate probit, heckman selection, tobit, naive bayes, multinomial regression, ordinal regression, quantile regression, marginal structural model, cubic spline, hurdle poisson, hurdle negbin, zero-inflated poisson, zero-inflated negbin, Cox survival, confirmatory factor analysis, Markov model, hidden Markov model (R) (Python), EM mixture univariate, EM mixture multivariate, EM probit, EM pca, EM probabilistic pca (with missing), EM state space model, Gaussian Process noisy, Gaussian Process noise-free, reproducing kernel hilbert space regression, extreme learning machine, Chinese restaurant process, Indian buffet process, One-line models (an exercise), ...

Bayesian (mostly with Stan/rstan)

BEST t-test, linear regression (Compare with BUGS version, JAGS), mixed model, mixed model with correlated random effects, beta regression, mixed model with beta response (Stan) (JAGS), mixture model, topic model, multinomial models, multilevel mediation, variational bayes regression, gaussian process, stochastic volatility, horseshoe prior, item response theory, ...

SC and TR

This part of the repository is deprecated, but used to be a section of 'short courses' and 'technical reports'. See the Workshops or docs repositories instead, or go to the workshops and documents sections of the website where you can see finished products ...

Other

Random shenanigans.

FizzBuzz test (R) (julia) (Python), Reverse a string recursively (R) (Python), Recursive Word Wrap (R) (Python), calculate compound interest recursively, get US Congress roll call data, Scrape xkcd (R) (Python), Shakespearean Insulter, ggplot2 theme, spurious correlation with ratios, R matrix speedups, ...

miscellaneous-r-code's People

Contributors

brandmaier avatar m-clark avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

miscellaneous-r-code's Issues

wrong iteration range

in line 30 of lasso.R there is a small error:
c_ = sapply(1:10, function(j) sum(X[,j]*(y - X[,-j]%*%w_old[-j])))
probably 1:10 should be 1:J

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.