Publications by Jay Lasker
Quick Heteroskedasticity-Robust Regressions in R
Setup library(pacman); p_load(sandwich, lmtest, jtools, huxtable) Rationale Heteroskedasticity-robust inference in finite samples has been primarily approached with HC estimators. Unfortunately, in R, there is not an automatic robust regression function for HCs 4 and 5. Below, I have provided a function for HC1-5 using sandwich and lmtest. T...
516 sym R (4394 sym/13 pcs) 1 tbl
New Workers are Unlikely to Harm Wages
Setup WageScaling <- function(n = 1, K = 1, m = 2, L = 1, a = 1/3, A = 1, p = 1, rnd = 3){ NewWage <- (1 - a) * A * ((n * K)/(m * L))^a RealWage <- NewWage/p cat(paste0("With a labor share of production of ", round(a * 100, rnd), "%, increasing the labor supply by a factor of ", m, " and multiplying the capital supply by ", n, ", wages ...
4393 sym
Diversity Indices, Ideology on Campus, and College Rankings
Setup library(DT) LiberalArtsColleges <- subset(data, Type == "LiberalArts"); nrow(LiberalArtsColleges) ## [1] 24 NationalUniversities <- subset(data, Type == "NationalUniversity"); nrow(NationalUniversities) ## [1] 134 CRITR <- function(n, alpha = .05){ df <- n - 2; CRITT <- qt(alpha/2, df, lower.tail = F) CRITR <- sqrt((CRITT^2)/((CRITT...
8005 sym R (13626 sym/115 pcs)
The Method of Multiple Thresholds
Statistical Note There is a La Griffe Du Lion note on this method (http://www.lagriffedulion.f2s.com/g.htm; see previously: https://rpubs.com/JLLJ/threshold, http://www.lagriffedulion.f2s.com/excel.htm). These quotes are instructive: A single, Gaussian-distributed variable uniquely determines the dense rank order of performance on large-scale...
27064 sym 15 img
The 2022 National ACT Profile Report
Function ThresholdMean <- function(FracA, FracB, rnd = 3){ Gap = qnorm(FracA) - qnorm(FracB) cat(paste0("Group A's mean is ", round(Gap, rnd), " SDs away from Group B's.", collapse = "\n"))} MethodOfThresholds <- function(G1, G2, epsilon = .00001, deltaS = 0, ...
6613 sym Python (12063 sym/137 pcs) 5 img
Ancestry and Self-Identification
Setup library(pacman); p_load(psych, pROC, ggplot2) describe(data) The juicr package was used for data extraction from Figure S9A of Bryc et al. (2015). The values for extracted datapoints obtained by juicr were clearly mostly accurate, but at the limit of 1, they systematically erred and every point of 1 was rounded to .963 instead. To co...
4768 sym R (13077 sym/19 pcs) 2 img
State-level Admixture and Test Scores in the United States
Setup MethodOfThresholds <- function(G1, G2, epsilon = .00001, deltaS = 0, rhoS = 1, sum = T, rnd = 3, DG = c("GDelta", "Cd")){ DG = ifelse(is.na(DG)...
8526 sym R (15714 sym/43 pcs) 13 img
Anti-Discrimination Laws, Mental Health Days, and Interaction Testing
Setup Three of these functions were derived based on papers mentioned in two blogposts from Daniel Lakens and one uses code derived based on a MOOC of his: https://daniellakens.blogspot.com/2014/05/prior-probabilities-and-replicating.html https://daniellakens.blogspot.com/2014/05/the-probability-of-p-values-as-function.html library(pacman); p_l...
7565 sym R (10475 sym/205 pcs) 5 img
The Effect of Education on Political Identification in the ANES
Setup library(pacman); p_load(psych, lavaan, sjmisc) data$EduDi16 <- rec(data$educ5_2016, rec = "1, 2, 3 = 0; 4, 5 = 1") data$ParDi16 <- rec(data$party7_2016, rec = "4, 5, 6, 7 = 0; 1, 2, 3 = 1") data$EduDi20 <- rec(data$educ5_2020, rec = "1, 2, 3 = 0; 4, 5 = 1") data$ParDi20 <- rec(data$party7_2020, rec = "4, 5, 6, 7 = 0; 1, 2, 3 = 1") de...
682 sym R (124447 sym/133 pcs)
Necessary vote capture to win a race
Setup RemainingVotes <- function(V1, V2, VP, rnd = 3){ VT = V1 + V2 VD = abs(V1 - V2) VRPT = VT/VP VR = ceiling(VRPT - VT) NP = (VD + (.5 * VR))/VR cat(paste0(round(NP * 100, rnd), "% of the remaining vote is required to change the result. \n"))} Rationale Here’s a function to determine how much of a the remaining vot...
845 sym