alcoff.e <- moffset(alcoff, "6", "Monday", postfix = "*") # Effective day
fit0 <- rcam(alcoff.e, family = poissonff)
par(oma = c(0, 0, 4, 0), mfrow = 1:2) # For all plots below too
ii = plot(fit0, rcol = "blue", ccol = "orange",
lwd = 4, ylim = c(-2, 2), # A common ylim
cylab = "Effective daily effects", rylab = "Hourly effects",
rxlab = "Hour", cxlab = "Effective day")
ii@post # Endowed with additional information
# Negative binomial example
fit1 <- rcam(alcoff.e, negbinomial, trace = TRUE)
plot(fit1, ylim = c(-2, 2))
# Univariate normal example
fit2 <- rcam(alcoff.e, normal1, trace = TRUE)
plot(fit2, ylim = c(-200, 400))
# Median-polish example
fit3 <- rcam(alcoff.e, alaplace2(tau = 0.5, intparloc = TRUE),
trace = TRUE)
plot(fit3, ylim = c(-200, 250))
# Zero-inflated Poisson example on "crashp" (no 0s in alcoff)
cbind(rowSums(crashp)) # Easy to see the data
cbind(colSums(crashp)) # Easy to see the data
fit4 <- rcam(Rcam(crashp, rbaseline = "5", cbaseline = "Sunday"),
zipoissonff, trace = TRUE)
plot(fit4, ylim = c(-3, 3))
Run the code above in your browser using DataLab