Skip to content

Instantly share code, notes, and snippets.

@jebyrnes
Last active December 31, 2015 07:09
Show Gist options
  • Save jebyrnes/7952287 to your computer and use it in GitHub Desktop.
Save jebyrnes/7952287 to your computer and use it in GitHub Desktop.
How much snow we might get, and where is the fun zone.
#the range of possible snow
minsnow <- 0
maxsnow <- 12 #1 foot - WOOOO!!!
#a range of snow values
snowdist <- seq(minsnow, maxsnow, 0.01)
len <- length(snowdist)
#let's assume a log normal distribution of the snow
#we might get, with a conservative mean of ~1
snow_depth <- dlnorm(snowdist, 1)
#what's the distribution look like?
plot(snowdist, snow_depth, type="l", xlab="Snow Depth (in)", ylab="Probability")
#how much of that distribution is SUPER FUN!!!
maxdist <- 330
polygon(c(snowdist[maxdist:len], snowdist[len: maxdist]),
c(rep(0, length(maxdist:len)), snow_depth[len: maxdist]), col="blue")
#The legend of the snow
legend(6, 0.2, "The fun snow tail!!!", "blue")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment