height distribution
s=seq(1.4,2.4,0.01) #height is between 1.4 and 2.4 m
d=dnorm(s,2,0.1) #height is distributed normally with mean = 2 m and sd =0.1
plot(s,d,type="l")
s=seq(1.4,2.4,0.01) #height is between 1.4 and 2.4 m
d=dnorm(s,2,0.1) #height is distributed normally with mean = 2 m and sd =0.1
plot(s,d,type="l")
To switch to %:
ddnorm=function(x,m,s){d=dnorm(x,m,s);dd=d/sum(d);return(dd)}
plot(seq(1.4,2.4,0.01),ddnorm(seq(1.4,2.4,0.01),2,0.1),type="l")
sum(ddnorm(seq(1.4,2.4,0.01),2,0.1)) #test on 100%
[1] 1
Немає коментарів:
Дописати коментар