Skip to content

Instantly share code, notes, and snippets.

View vincentarelbundock's full-sized avatar

Vincent Arel-Bundock vincentarelbundock

View GitHub Profile
@vincentarelbundock
vincentarelbundock / rr.ipynb
Last active May 5, 2016 21:35
Reinhart-Rogoff replication
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vincentarelbundock
vincentarelbundock / ex_arma2.ipynb
Created August 26, 2012 23:38
Statsmodels example: Autoregressive Moving Average (ARMA) Model
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vincentarelbundock
vincentarelbundock / example_ols.ipynb
Created August 26, 2012 23:28
Statsmodels example: Ordinary least squares regression
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
✔ | OK F W S | Context
⠏ | 0 | test-aaa-documentation-helper
⠋ | 0 1 | test-aaa-documentation-helper
✔ | 0 1 | test-aaa-documentation-helper
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
test-aaa-documentation-helper.R:3: skip: (unknown)
documentation helper tests not yet written
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
library(tidyverse)
example <- tibble(id = 1:500,
A = sample(TRUE:FALSE, 500, replace = TRUE),
B = sample(TRUE:FALSE, 500, replace = TRUE),
C = sample(TRUE:FALSE, 500, replace = TRUE),
D = sample(TRUE:FALSE, 500, replace = TRUE),
E = sample(TRUE:FALSE, 500, replace = TRUE),
F = sample(TRUE:FALSE, 500, replace = TRUE))

These packages were checked are are compatible with stats::nobs:

  • aer
  • plm
  • betareg
  • gam
  • gamlss
  • geefit
  • glmnet
  • lme4
library(gghighlight)
library(tidyverse)
# load data
raw <- read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-03-03/game_goals.csv')
# 8 best scorers (there are 8 colors in scale_color_brewer Dark2)
best <- raw %>%
group_by(player) %>%
summarize(goals = sum(goals)) %>%
---
title: "COVID-19 Worldometer data"
output: html_notebook
---
This notebook pulls a table with useful information out of ![worldometer](https://www.worldometers.info/coronavirus/) and then makes a graph.
```{r}
library(WDI)
library(countrycode)
library(lme4)
library(gt)
library(modelsummary)
library(tidyverse)
# y dependent variable
# x regressor varies at the county-year level
# z regressor varies at the county level
url <- 'https://vincentarelbundock.github.io/Rdatasets/csv/plm/Crime.csv'
@vincentarelbundock
vincentarelbundock / munklak_sim.R
Created April 24, 2020 20:11
munklak simulation
library(lfe)
library(lme4)
library(MASS)
library(tidyverse)
library(modelsummary)
set.seed(290653)
sim <- function(Nobs = 100, Ngrp = 50, cor_x_u = .6, x_sd = .2, y_sd = 1, ...) {
group <- mvrnorm(Ngrp, c(0, 0), matrix(c(1, cor_x_u, cor_x_u, 1), ncol = 2)) %>%
data.frame %>% setNames(c('U', 'Ucor')) %>%