Created
April 3, 2014 00:53
-
-
Save davharris/9946350 to your computer and use it in GitHub Desktop.
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(ggplot2) | |
library(mgcv) | |
# Something bad happens at t=400 and lambda drops | |
lambdas = c(runif(4E2, 6, 8), runif(1E2, 2, 4)) | |
obs = rpois(length(lambdas), lambdas) | |
qplot(x = 1:length(obs), y = obs) + | |
stat_smooth(method = "gam", family = poisson, formula = y ~ s(x), size = 3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Kernel regression might be better-suited for this, but I'm not sure if it has ggplot2 integration, so I used a GAM :-)