m <- mean(Nile)
std <- sd(Nile)
x <- seq(from = 400, to = 1400, by = 1)
hist(Nile, freq = FALSE, col = "blue", xlab = "Flow", main = "Histogram of Nile River Flows, 1871 to 1970")
curve(dnorm(x, mean = m, sd = std), col = "yellow", lwd = 2, add = TRUE)

#Binomial distribution
n <- 15
p <- 0.5
#Poisson distribution
lambda_p <- 6
pdf_b <- dbinom(0:20, size = n, prob = p)
pdf_p <- dpois(0:15,lambda = lambda_p)
#plot binomial
plot(0:20,pdf_b, freq = FALSE,type = "b", col = "blue", xlab = "Number of Trials", main = "Binomial Distribution", ylab = "Density")
## Warning in plot.window(...): "freq" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "freq" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...): "freq" is not a
## graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...): "freq" is not a
## graphical parameter
## Warning in box(...): "freq" is not a graphical parameter
## Warning in title(...): "freq" is not a graphical parameter

#plot poisson
plot(0:15,pdf_p,type = "h", col = "blue", main = "Poisson Distribution",ylab = "Density", xlab = "number of trials")
