Dibujar y calcular la Moda y la Mediana de una Logaritmo- Normal con R-Project

Vamos a dibujar y calcular la moda y la mediana con R-Project de las distrbuciones continuas Logaritmo-Normal, LN(1 , 0'5) y LN(1 , 0'2)

Instalamos el paquete "modeest" en el R-Project.


Programa:

> library (modeest)
> par(mfrow=c(2,1))
>
> curve(dlnorm(x,meanlog =1, sdlog =0.2), 1, 5)
> moda <- lnormMode(meanlog = 1, sdlog = 0.2)
> mediana <- qlnorm(0.5, meanlog = 1, sdlog = 0.2)
> points(moda, dlnorm(moda,meanlog =1, sdlog =0.2))
> text(moda, dlnorm(moda,meanlog =1, sdlog =0.2), "Moda",pos=2)
> points(mediana, dlnorm(mediana,meanlog =1, sdlog =0.2))
> text(mediana, dlnorm(mediana,meanlog =1, sdlog =0.2), "Mediana",pos=4)
>
> curve(dlnorm(x,meanlog =1, sdlog =0.5), 0, 6)
> mediana2 <- qlnorm(0.5, meanlog = 1, sdlog = 0.5)
> moda2 <- lnormMode(meanlog = 1, sdlog = 0.5)
> points(moda2, dlnorm(moda2,meanlog =1, sdlog =0.5))
> text(moda2, dlnorm(moda2,meanlog =1, sdlog =0.5), "Moda",pos=2)
> points(mediana2, dlnorm(mediana2,meanlog =1, sdlog =0.5))
> text(mediana2, dlnorm(mediana2,meanlog =1, sdlog =0.5), "Mediana",pos=4)


Figura:


No hay comentarios: