data(Cormorants)
str(Cormorants)
if (require("ggplot2")) {
print(ggplot(Cormorants, aes(count)) +
geom_histogram(binwidth=0.5) +
labs(x="Number of birds advertising"))
# Quick look at the data, on the log scale, for plots of `count ~ week`,
# stratified by something else.
print(ggplot(Cormorants, aes(week, count, color=height)) +
geom_jitter() +
stat_smooth(method="loess", size=2) +
scale_y_log10(breaks=c(1,2,5,10)) +
geom_vline(xintercept=c(4.5, 9.5)))
}
# ### models using week
fit1 <-glm(count ~ week + station + nest + height + density + tree_health,
data=Cormorants,
family = poisson)
if (requireNamespace("car"))
car::Anova(fit1)
# plot fitted effects
if (requireNamespace("effects"))
plot(effects::allEffects(fit1))
Run the code above in your browser using DataLab