This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# plot is here: https://fivethirtyeight.com/features/the-dollar-and-cents-case-against-hollywoods-exclusion-of-women/ | |
library(tidyverse) | |
library(fivethirtyeight) | |
library(lubridate) | |
library(scales) | |
extract_period <- function(year) { | |
period <- year - year %% 5 | |
century <- year - year %% 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
library(glmnet) | |
res_list <- list() | |
get_poly_coef <- function(x, y, max_degree = 5) { | |
if (length(x) < 20) { | |
warning('x length less than 20') | |
} | |
mm <- model.matrix(~ poly(x, degree = max_degree, raw = TRUE))[, -1] |