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") 

enter image description here


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -