Skip to content

Instantly share code, notes, and snippets.

@soodoku
soodoku / empirical-logistic.stan
Last active May 14, 2025 05:52
Wasserstein Prior
data {
int<lower=0> N;
int<lower=0> D;
matrix[N, D] x;
array[N] int<lower=0, upper=1> y;
real<lower=0> h;
int<lower=0> B;
array[B] vector[D] beta0;
@soodoku
soodoku / data.py
Created April 24, 2025 04:24
List all dataverse repos.
#!/usr/bin/env python3
import argparse
import json
import requests
import sys
from urllib.parse import quote
def parse_arguments():
"""Parse command line arguments"""
parser = argparse.ArgumentParser(description="List Dataverse datasets owned by a user and convert to JSON")
@soodoku
soodoku / Continuous Hinger.md
Last active April 15, 2025 21:32
Continuous Hinge Function
@soodoku
soodoku / calibration_plot.png
Last active April 13, 2025 21:09
Vanilla Xgboost miscalibration
calibration_plot.png
@soodoku
soodoku / dataverse.py
Created April 3, 2025 18:59
Dataverse Uploaded
#!/usr/bin/env python3
"""
Dataverse File Uploader
A script to upload files to Harvard Dataverse or other Dataverse instances.
"""
import os
import argparse
import requests
@soodoku
soodoku / tariffs.ipynb
Last active April 3, 2025 17:29
Tariffs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@soodoku
soodoku / Readme.md
Last active March 5, 2025 01:05
i4replication scraper

Scraping the abstracts for the discussion papers by i4replication.org.

@soodoku
soodoku / readme.md
Last active May 14, 2025 11:36
RQ Boot Results to Latex Table

RQ Boot to Latex

ModelSummary and Stargazer fail when RQ s.e. calculation fails

stargazer(m_demo_int_qr)
Error in base::backsolve(r, x, k = k, upper.tri = upper.tri, transpose = transpose,  : 
  singular matrix in 'backsolve'. First zero in diagonal [13]
@soodoku
soodoku / stratified_vs_srs.R
Last active January 15, 2025 02:49
Alternate Herding
-------------
set.seed(123)
# Step 1: Simulate Population
num_strata <- 10 # Number of strata
population_size <- 100000 # Total population size
# Generate strata sizes and proportions
@soodoku
soodoku / demand_supply.R
Last active December 27, 2024 01:13
demand/supply misleading beta
# Set random seed for reproducibility
set.seed(123)
# Time t parameters
n_novels_x_t <- 500 # 50% of 1000 novels are type x at time t
n_novels_y_t <- 500
k <- 30 # 30% more likely to read type x
total_readings <- 800 # Fixed total reading capacity
# Time t simulation