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
(require '[clara.rules :as r]) | |
;;;; Define 3 rules, where the "priority" order is r1, r2, r3, where the highest priority is first | |
;;;; and the rest is in descending order of priority. | |
;;;; :type :rule/result "syntetic" fact is used to hold the final changes that can be queried out | |
;;;; from a session after `r/fire-rules` via `r/query` on the `find-results` query. | |
;;;; A namespace qualified keyword is used to avoid collision with externally given :type of | |
;;;; "real" facts. |
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(tidyverse) | |
library(broom) | |
US <- read_csv("https://raw.githubusercontent.com/nytimes/covid-19-data/master/us.csv") %>% | |
mutate(new_deaths = deaths - lag(deaths)) %>% | |
filter(date >= "2020-02-26") | |
models <- tibble(degrees = 2:4) %>% | |
mutate(model = map(degrees, ~ lm(log(new_deaths + 1) ~ poly(date, .), data = US))) |