@@ -87,24 +87,29 @@ Yes, an example with the Burr distribution is detailed in the JSS paper. We repr
87
87
``` {r, message=FALSE}
88
88
data("endosulfan")
89
89
library("actuar")
90
- fendo.B <- fitdist(endosulfan$ATV, "burr", start = list(shape1 = 0.3, shape2 = 1, rate = 1))
90
+ fendo.B <- fitdist(endosulfan$ATV, "burr", start = list(shape1 = 0.3,
91
+ shape2 = 1, rate = 1))
91
92
summary(fendo.B)
92
93
```
93
94
94
95
## Why there are differences between MLE and MME for the lognormal distribution?
95
96
We recall that the lognormal distribution function is given by
97
+
96
98
$$
97
99
F_X(x) = \Phi\left(\frac{\log(x)-\mu}{\sigma} \right),
98
100
$$
101
+
99
102
where $\Phi$ denotes the distribution function of the standard normal distribution.
100
103
We know that $E(X) = \exp\left( \mu+\frac{1}{2} \sigma^2 \right)$
101
104
and $Var(X) = \exp\left( 2\mu+\sigma^2\right) (e^{\sigma^2} -1)$.
102
105
The MME is obtained by inverting the previous formulas, whereas
103
106
the MLE has the following explicit solution
107
+
104
108
$$
105
109
\hat\mu_{MLE} = \frac{1}{n}\sum_{i=1}^n \log(x_i),~~
106
110
\hat\sigma^2_{MLE} = \frac{1}{n}\sum_{i=1}^n (\log(x_i) - \hat\mu_{MLE})^2.
107
111
$$
112
+
108
113
Let us fit a sample by MLE and MME. The fit looks particularly good in both cases.
109
114
110
115
``` {r, fig.height=3.5, fig.width=7}
@@ -117,11 +122,13 @@ denscomp(list(f1, f2), demp=TRUE, main = "Density plot")
117
122
```
118
123
119
124
Let us compare the theoretical moments (mean and variance) given the fitted values
125
+
120
126
($\hat\mu,\hat\sigma$), that is
121
127
$$
122
128
E(X) = \exp\left( \hat\mu+\frac{1}{2} \hat\sigma^2 \right),
123
129
Var(X) = \exp\left( 2\hat\mu+\hat\sigma^2\right) (e^{\hat\sigma^2} -1).
124
130
$$
131
+
125
132
``` {r}
126
133
c("E(X) by MME"=as.numeric(exp(f2$estimate["meanlog"]+f2$estimate["sdlog"]^2/2)),
127
134
"E(X) by MLE"=as.numeric(exp(f1$estimate["meanlog"]+f1$estimate["sdlog"]^2/2)),
0 commit comments