# EXAMPLE 7: Introduction to Statistics for Astrophysicists
# SS 2012
# JOCHEN WELLER

# LOG-NORMAL PROBABILITY


x=seq(0,4,by=0.1)

mu=0.0
sigma=1.0
norm=1.0/sqrt(2.0*pi)/sigma
plot(x,norm*exp(-(log(x)-mu)^2/sigma^2)/x,type='l',xlim=c(0,4),ylim=c(0,1),xlab='x',ylab="f(x;mu,sigma)",lwd=2)



mu=0
sigma=1.5
norm=1.0/sqrt(2.0*pi)/sigma
lines(x,norm*exp(-(log(x)-mu)^2/sigma^2)/x,lwd=2,lty=2)

mu=0
sigma=0.5
norm=1.0/sqrt(2.0*pi)/sigma
lines(x,norm*exp(-(log(x)-mu)^2/sigma^2)/x,lwd=2,lty=3)

mu=1
sigma=1.0
norm=1.0/sqrt(2.0*pi)/sigma
lines(x,norm*exp(-(log(x)-mu)^2/sigma^2)/x,lwd=2,lty=4)


legend("topright",legend=c("mu=0,sigma=1","mu=0,sigma=1.5","mu=0,sigma=0.5","mu=1,sigma=1"),lty=c(1,2,3,4),lwd=c(2,2,2,2),col=c("black","black","black","black"))