Created
August 27, 2015 05:45
-
-
Save mages/11687dea226d527398fa 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(lattice) | |
key <- list( | |
rep=FALSE, | |
lines=list(col=c("#00526D", "blue"), type=c("p","l"), pch=1), | |
text=list(lab=c("Observation","Estimate")), | |
rectangles = list(col=adjustcolor("yellow", alpha.f=0.5), border="grey"), | |
text=list(lab="95% Prediction credible interval")) | |
xyplot(l.95..CI + u.95..CI + Estimate + Units_sold ~ Temperature | Model, | |
data=modelData, as.table=TRUE, main="Ice cream model comparision", | |
xlab="Temperatures (C)", ylab="Units sold", | |
scales=list(alternating=1), key=key, | |
panel=function(x, y){ | |
n <- length(x) | |
k <- n/2 | |
upper <- y[(k/2+1):k] | |
lower <- y[1:(k/2)] | |
x <- x[1:(k/2)] | |
panel.polygon(c(x, rev(x)), c(upper, rev(lower)), | |
col = adjustcolor("yellow", alpha.f = 0.5), | |
border = "grey") | |
panel.lines(x, y[(k+1):(k+n/4)], col="blue") | |
panel.points(x, y[(n*3/4+1):n], lwd=2, col="#00526D") | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment