graphics - Drawing a graph using dnorm and polygon function in R -
i have found probability using..
pnorm(176, 135, 10, lower.tail=true) - pnorm(146, 135, 10, lower.tail=true)
which resulted in 0.1356, 14%.
i have use dnorm , polygon function create graph shows shaded area (based on percentage above) in normal distribution.
anyone got idea how so?
something this:
library(ggplot2) x=seq(80,190,1) dat = data.frame(x, dens=dnorm(x,135,10)) ggplot(dat, aes(x,dens)) + geom_line() + geom_area(data=dat[dat$x >= 146 & dat$x <= 176,], fill="red")
Comments
Post a Comment