Skip to content

Instantly share code, notes, and snippets.

@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
@soodoku
soodoku / attenuation.R
Created September 22, 2024 00:20
Attenuation Bias Simulation
# Set seed for reproducibility
set.seed(123)
# Number of observations
n <- 1000
# Simulate a perfectly measured outcome (Y_perfect)
# Treatment effect
treatment_effect <- 5
base_noise <- rnorm(n, mean = 0, sd = 1) # Base noise for the perfect outcome
@soodoku
soodoku / shrug_2011_vd.R
Created March 29, 2024 00:27
Skew in Village Pop. in India With Implications for Optimal Strategy to Reach Out
library(readr)
shrug <- read_csv("/Users/soodoku/Downloads/shrug-vd11-csv/pc11_vd_clean_shrid.csv")
# Take out missing from village pop (just 1) and sort
t_pop <- shrug$pc11_vd_t_p[!is.na(shrug$pc11_vd_t_p)]
sorted_values <- sort(t_pop, decreasing = TRUE)
# We have like 570k villages. 50k villages have ...
sum(sorted_values[1:50000])/sum(sorted_values)
# [1] 0.3720554
@soodoku
soodoku / jokes.md
Last active January 25, 2024 23:53
Jokes
  1. What virus did Gautam Budh Have? Karuna virus.
  2. Deva o deva, deva o deva, tumse badkar kaun ....? Tumhara baap
  3. Which kinds of people don't have a magnetic personality? People with no sense of irony.
  4. What does a bald Muslim man want most? Iqbal
@soodoku
soodoku / guaranteed_rewards.md
Last active November 16, 2023 06:04
Guaranteed Rewards

Self Marketing in Prayers

Laxmi Aarti

महालक्ष्मी जी की आरती,
जो कोई नर गाता ।
उँर आंनद समाता,
पाप उतर जाता ॥

@soodoku
soodoku / bihar_jati_2022.csv
Last active November 2, 2023 23:45
Bihar Jati 2023
page क्र ० सं ० जाति आंकड़ा प्रतिशत ( % )
0 1 अघोरी 9039 0.0069 %
0 2 अदरखी 30857 0.0236 %
0 3 अबदल 11433 0.0087 %
0 4 अमात 285221 0.2182 %
0 5 अवध बनिया 41643 0.0319 %
0 6 असुर , अगरिया 7706 0.0059 %
0 7 इदरीसी या दर्जी ( मुस्लिम ) 329661 0.2522 %
0 8 ईटफरोश / ईटाफरोश / गदहेड़ी / ईटपज इब्राहिमी ( मुस्लिम ) 9462 0.0072 %
0 9 इसाई धर्मावलंबी ( हरिजन ) 9708 0.0074 %
@soodoku
soodoku / TrainingV3.ipynb
Created October 8, 2023 19:14
Facial Sentiment Classifier
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@soodoku
soodoku / senator_ed.csv
Last active October 11, 2023 20:58
education of a senator
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 8.
State,Name,Party,Rel.,Prior Exp.,Education,Year in,Born,Top College,R Top Coll.,D Top Coll.,Ad. Degree,R ,D
Alabama ,Richard Shelby ,Republican ,Presbyterian ,"U.S. House, Alabama Senate ","Alabama (BA, JD) ",1987,1934,,0,0,1,1,0
Alabama ,"Sessions, JeffJeff Sessions ",Republican ,Methodist ,Alabama Attorney General ,"Huntingdon College, University of Alabama ",1997,1946,,0,0,1,1,0
Alaska ,"Murkowski, LisaLisa Murkowski ",Republican ,Roman Catholic ,Alaska House of Representatives ,"Georgetown, Willamette ",2002,1957,,0,0,1,1,0
Alaska ,"Begich, MarkMark Begich ",Democratic ,Roman Catholic ,Mayor of Anchorage ,University of Alaska Anchorage (attended) ,2009,1962,,0,0,,0,0
Arizona ,"McCain, JohnJohn McCain ",Republican ,Baptist[1] ,"U.S. House, military ",U.S. Naval Academy[2] ,1987,1936,,0,0,1,1,0
Arizona ,"Kyl, JonJon Kyl ",Republican ,Presbyterian ,U.S. House ,"Arizona (BA, JD) ",1995,1942,,0,0,1,1,0
Arkansas ,"Lincoln, BlancheBlanche Lincoln ",Democratic ,Episcopalian ,U.S. House ,"Randolph-Macon Women\'s C
@soodoku
soodoku / towns.csv
Last active September 25, 2023 23:15
US Towns with Lat/Long
We can't make this file beautiful and searchable because it's too large.
Alabama,Abanda,33.10,-85.53,639
Alabama,Abbeville,31.57,-85.25,426
Alabama,Abbot Springs,33.36,-86.48,600
Alabama,Abel,33.55,-85.71,912
Alabama,Abercrombie,32.85,-87.16,291
Alabama,Aberfoil,32.07,-85.69,600
Alabama,Abernant,33.29,-87.20,459
Alabama,Abernathy,33.65,-85.41,1000
Alabama,Abernathy (historical),33.80,-85.57,1282
Alabama,Abihka (historical),33.30,-86.16,600