Skip to content

Instantly share code, notes, and snippets.

View seananderson's full-sized avatar

Sean Anderson seananderson

View GitHub Profile
@inventionate
inventionate / install-r.sh
Last active August 31, 2023 18:27
Install R with OpenBLAS via Homebrew
# Stat Installation
# XCode CLT
xcode-select --install
# Update Homebrew
brew update
# Check for broken dependencies and/or outdated packages
brew doctor
@MatsuuraKentaro
MatsuuraKentaro / model.stan
Last active March 5, 2024 06:08
Tweedie distribution in Stan
data {
int N;
int M;
real<lower=0> Y[N];
}
parameters {
real<lower=0> mu;
real<lower=0> phi;
real<lower=1, upper=2> theta;
@hadley
hadley / advise.md
Created February 13, 2015 21:32
Advise for teaching an R workshop

I think the two most important messages that people can get from a short course are:

a) the material is important and worthwhile to learn (even if it's challenging), and b) it's possible to learn it!

For those reasons, I usually start by diving as quickly as possible into visualisation. I think it's a bad idea to start by explicitly teaching programming concepts (like data structures), because the pay off isn't obvious. If you start with visualisation, the pay off is really obvious and people are more motivated to push past any initial teething problems. In stat405, I used to start with some very basic templates that got people up and running with scatterplots and histograms - they wouldn't necessary understand the code, but they'd know which bits could be varied for different effects.

Apart from visualisation, I think the two most important topics to cover are tidy data (i.e. http://www.jstatsoft.org/v59/i10/ + tidyr) and data manipulation (dplyr). These are both important for when people go off and apply

@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active June 28, 2024 10:38
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@andydawson
andydawson / gradient.md
Last active April 12, 2023 09:03
Manual gradient in Stan 2.10

Implementing your own gradient function in Stan.

Here's a summary of how to implement a gradient function manually in Stan 2.10 in order to override autodiff. I wanted to do this because my run-times were long, and I knew I could save some time by hard-coding my gradient function. That being said, autodiff is great, and is almost always fast enough.

Step 1. Create the .stan file which implements the model.

Two reasons to do this:

  1. This will allow you to easily generate a .cpp file that will contain the basic structure you need.
  2. Great for testing to make sure your hacked code gives identical output to what you would get using Stan.