Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trend lines for log plots #6

Open
jsfenfen opened this issue Apr 17, 2020 · 0 comments
Open

trend lines for log plots #6

jsfenfen opened this issue Apr 17, 2020 · 0 comments

Comments

@jsfenfen
Copy link
Owner

jsfenfen commented Apr 17, 2020

On mouseover should display 7-day trend line, this is it in R

# Assume a csv with headers "Cases" and "day", the latter starting at 1
# and read it into data
data <- read.csv(datafile)
# eyeball it on a linear scale to see if it looks right
plot(data$day,data$Cases)
# linear regression on base 2 log of cases vs days, 22-26 observations only
fit <- lm( data[22:26,"day"] ~ log2(data[22:26,"Cases"]) )
# spit out the doubling time in days
fit$coef[2]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant