Skip to content

Instantly share code, notes, and snippets.

@MCMaurer
Created December 14, 2018 05:39
Show Gist options
  • Save MCMaurer/c64470821baad4b32c24bfe4656c5a5c to your computer and use it in GitHub Desktop.
Save MCMaurer/c64470821baad4b32c24bfe4656c5a5c to your computer and use it in GitHub Desktop.
p <- 10^(seq(-4,0,0.2))
x <- 1:21
d <- cbind(x,p)
d <- d %>% as.data.frame()
loglogmodel <- lm(data = d, formula = log(p) ~ log(x))
ggplot(d, aes(x=x, y=p)) +
geom_point() +
geom_line(aes(x = exp(loglogmodel$model$`log(x)`), y = exp(loglogmodel$fitted.values)), color = "blue")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment