I have the following generated dataset
library(MASS)
df <- data.frame(product= sample(x= c("toyota","honda","nissan","bmw"),size = 1000 ,replace = TRUE),
parameter = sample(x= c("X","Y", "A"),size = 1000 ,replace = TRUE),
value= rgamma(1000, shape = 5, rate = 0.1))
and I want to fit the lognormal distribution on column "value" and I use the following code
dist_par <- fitdistr(unlist(df["value"]), "lognormal")
the result is something like below:
meanlog sdlog
3.8416 0.4292
(0.0458) (0.0324)
I have two questions:
- I read the help and I guess that the meanlog and sdlog estimations are shown on the first row:
meanlog sdlog 3.8416 0.4292
but the second row of numbers (numbers in parentheses) are confusing, what are they?
meanlog sdlog
.... ....
(0.0458) (0.0324)
- I know the result of fitdistr is a list but I don't know how to have access to those four values. For instance how can I get
3.8416?
If I run
dist_par[1]
then I get
meanlog sdlog 3.842 0.429
and if I run:
dist_par[1,1]
then I get the following error:
Error in dist_par[1, 1] : incorrect number of dimensions