/Miscellaneous-R-Code

Code that might be useful to others for learning/demonstration purposes, specifically along the lines of modeling and various algorithms.

Primary LanguageR

Miscellaneous (mostly) R Code

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, 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, ...