Tuesday, December 22, 2020

"How the Wall Street Journal visualized the 2020 election results"

How the Wall Street Journal visualized the 2020 election results

Tools mentioned:
  • d3: "We use a lot of D3, it seems to be a pretty standard thing in our world."
  • React: "Typically, I guess the landscape is very heavy with JavaScript nowadays, specifically with React as a front-end library. We’ve leveraged a lot of that with the work that we did here and it helped us make components that were easily put anywhere for us."
  • Next.js: "I’ll also mention how important automation is for what we do. We were using a technology called Next.js to generate all of our election pages, and we were able to very easily create multiple modules based on this technology."

Tuesday, September 1, 2020

XOR

d <- data.frame(y=c(0, 1, 1, 0),
  x1=c(1, 1, 0, 0), x2=c(1, 0, 1, 0))
f <- glm(y~x1*x2, data=d, family=binomial(link="logit"))

> f$coefficients
(Intercept)          x1          x2       x1:x2 
  -23.56607    47.13214    47.13214   -94.26427
> f$fitted.values
           1            2            3            4 
5.826215e-11 1.000000e+00 1.000000e+00 5.826215e-11 
> f$fitted.values > 0.5
    1     2     3     4 
FALSE  TRUE  TRUE FALSE