Point estimation — step-by-step proofs with the campus station, the log-likelihood and the second derivative (and the uniform derivative that never hit zero)
In a practice exam in class I applied the maximum likelihood recipe to a uniform(0, θ) without thinking and was left staring at a −n/θ = 0 that has no solution. Log, derivative, set to zero… and nothing. I spent five minutes convinced I had differentiated wrong. I had not: the derivative was right. What failed was the idea that the maximum is always where the derivative is zero. In the uniform it is at an edge, and to see it you have to draw the likelihood before differentiating anything.
In the point estimation theory you saw the two methods (moments and maximum likelihood) and a table with what each gives. Here is where every row of that table comes from: seven proofs with the weather station on the Tafira rooftop (wind, gusts, rainy days, rain and upload delay), each step with the rule that justifies it and checked in R. These are the derivations asked for in the EC2, usually in the first part of an exercise, and everything else depends on them.
Table of Contents
Before you start: the rules we will use
The proofs cite these rules by number (“by rule 2”):
- Log of a product. .
- Log of a power and of the exponential. and .
- Product of powers. and .
- Derivatives that always turn up. , , , .
- Maximum criterion. If and , there is a maximum at . If moreover on the whole domain, it is the only one.
- The log is increasing. Maximising and maximising give the same .
- Gamma integral. for , with and .
- Moments of the known distributions:
| Distribution | ||
|---|---|---|
| Bernoulli(p) | ||
| Poisson(λ) | ||
| exp(λ) | ||
| gamma(α, β) | ||
| uniform(a, b) | ||
| normal(μ, σ) |
And the notation: is the sample mean, the second central moment (divides by n), the moments estimator and the maximum likelihood one. When a sum keeps coming up, we call it or .
These are the station data used in the “Check it in R” sections:
wind <- c(7.9, 12.2, 11.5, 11.8, 7.0, 11.7, 4.6, 20.3, 9.4, 10.6,
12.9, 3.1, 9.2, 27.3, 12.3, 5.5, 14.2, 14.2, 7.4, 21.1,
14.6, 6.4, 25.4, 8.2, 14.8, 4.1, 7.1, 18.0, 5.6, 16.4,
13.1, 19.7, 12.1, 11.0, 9.1, 20.8, 21.7, 18.6, 1.2, 4.5)
gusts <- c(2, 6, 4, 4, 9, 4, 4, 1, 3, 3, 1, 4, 1, 1, 3, 2, 2, 3, 4, 3, 1, 4, 6, 2)
rains <- c(0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1)
rain <- c(5.0, 8.8, 6.8, 6.1, 0.8, 8.7, 3.7, 10.0, 7.4, 1.6,
7.1, 1.3, 7.5, 6.6, 12.0, 4.0, 7.2, 12.2, 14.8, 6.6)
delay <- c(1.34, 1.18, 2.95, 3.36, 3.51, 1.17, 3.42, 3.74, 1.62, 0.91, 0.05, 1.01, 3.35, 0.52, 1.37)
tnight <- c(12.7, 16.1, 14.4, 16.4, 9.3, 12.5, 10.8, 12.4, 16.2, 13.9, 14.6, 16.6, 15.8, 16.5, 12.5)
s2p <- function(x) mean((x - mean(x))^2) # S'^2: divides by n
tnight is new: the minimum temperature on 15 nights, in °C, which we will use in proof 5 with a normal.
Proof 1: the mean of the Rayleigh and its moments estimator
What we want to prove
If is a Rayleigh with parameter α, with density for , then
Why it matters. The wind is modelled with a Rayleigh, and its mean is not in the table of rule 8: you have to integrate. Without as a function of α there is nothing to match to , and the method cannot even start.
Where we start
From the definition of expectation, , and rule 7. The idea is to turn the integral into a gamma-type one with a change of variable.
Step 1: write the integral
The comes outside because it does not depend on x.
Step 2: the change t = x²
With : , , and the limits are still 0 and ∞ (x ≥ 0). Substituting:
because .
What gets skipped: from you get , so . Why this substitution? Because it turns into , the shape of rule 7.
Step 3: recognise the gamma
The integral is the one in rule 7 with , that is , and :
Step 4: simplify
Equality by equality: dividing by is multiplying by ; dividing by subtracts exponents (); and the 2 at the bottom goes into the root as .
For , the same path with one more x: , and with it becomes . We will use it in proof 7.
Step 5: set equal and solve
One parameter, one equation: .
Squaring loses nothing: both sides are positive.
Forgetting the of the in the change of variable, or the outside. You get a mean that does not grow like and the estimator is off by a factor. Check the units: α is in km²/h², so has to go like .
Result for the cheat sheet. Rayleigh(α): , , .
Check it in R
drayleigh <- function(x, alpha) x / alpha * exp(-x^2 / (2 * alpha)) a <- 2 * mean(wind)^2 / pi # moments c(alpha_mm = a, E_integral = integrate(function(x) x * drayleigh(x, a), 0, Inf)$value, E_formula = sqrt(a * pi / 2), mean = mean(wind), E2_integral = integrate(function(x) x^2 * drayleigh(x, a), 0, Inf)$value)
Output:
alpha_mm E_integral E_formula mean E2_integral 94.21159 12.16500 12.16500 12.16500 188.42319
The mean integrated numerically with gives exactly : that is what the method asks for. And gives 188.42, which is .
Check you’ve got it: if every wind reading were doubled, what would the moments estimator of α be?
376.85, four times 94.21. goes with the square of the mean: if every data point doubles, is multiplied by 4. It matches the units in the error box: α is in km²/h².
Proof 2: moments with two parameters (and why it is not unique)
What we want to prove
For the gamma(α, β) and the uniform(a, b), with a simple random sample of size n:
Why it matters. With two parameters you need a system, and it gives the 3.768 and 0.545 of the rain gamma from the theory. And step 3 shows something awkward: the method can give two answers for the same parameter.
Where we start
With two parameters you need two equations. Matching to is the same as matching the variance to , because and . We use the mean and variance from rule 8.
Step 1: the gamma
Divide (1) by (2): . Substitute in (1): .
Why divide: α multiplies in both equations, so dividing makes it vanish and leaves β alone. Then you substitute to get α.
Step 2: the uniform(a, b)
From (2), . Since , the positive root: . From (1), . Adding and subtracting the two:
The estimated interval is centred on the mean and has on each side.
The root is taken positive because . And adding and subtracting works because (1) gives and (2) gives : adding them, a goes away; subtracting them, b does.
Step 3: why it is not unique
In the Poisson, and also . If you match the mean, ; if you match the variance, . Both are method of moments estimators, and with the gusts they give 3.21 and 3.50. The method does not say which to choose; by convention the lowest-order moments (the mean) are used, and the next topic gives the criterion for comparing.
Using (the one from var()) instead of . The method matches moments, and the central moment of the sample divides by n. In the exam, write the definition of before using it.
Result for the cheat sheet. Gamma: , . Uniform(a, b): . Poisson: (or : not unique).
Check it in R
round(c(shape = mean(rain)^2 / s2p(rain), rate = mean(rain) / s2p(rain),
a = mean(delay) - sqrt(3 * s2p(delay)), b = mean(delay) + sqrt(3 * s2p(delay)),
lambda1 = mean(gusts), lambda2 = s2p(gusts)), 3)
Output:
shape rate a b lambda1 lambda2 3.768 0.545 -0.149 4.082 3.208 3.498
The gamma of the rain by moments, 3.768 and 0.545, as in the theory. And a detail of the uniform(a, b) with the delays: is above the largest delay (3.74), fine, but is negative: a delay cannot be. The method of moments does not know that the data have to fall inside the interval; if it happens in the exam, you take and , or use maximum likelihood.
Check you’ve got it: if in the Poisson the mean and the variance are both λ, why do the gusts give 3.21 and 3.50?
Because the equality holds for the population, not for the sample. and are random variables: with 24 hours, each one strays from λ on its own. If they came out very different (a variance three times the mean), that would be a hint that the Poisson does not fit.
Proof 3: MLE of the Bernoulli and the Poisson
What we want to prove
With a simple random sample of size n and :
and that in both cases it is a maximum.
Why it matters. They are the template for the whole topic: L, logarithm, derivative, second derivative. And the result is reassuring: the MLE of p is the proportion you would guess by eye. With 9 rainy days out of 30, .
Where we start
From the masses for and for , and the four-step procedure from the theory.
Step 1: the Bernoulli likelihood
by rule 3, because .
Why: each is 0 or 1, so each factor is p (it rained) or (it did not). There are s factors p and factors .
Step 2: log, derivative and set to zero
By rules 1 and 2, . By rule 4:
It is zero when the numerator is 0: .
What gets skipped: , and the two cancel. The denominator is positive on (0, 1): only the numerator counts.
Step 3: the second derivative
Both terms are negative (or zero) for any p in (0, 1), so on the whole interval: by rule 5, is the only maximum.
Step 4: the Poisson
The last term does not depend on λ: it disappears when you differentiate. That is why in the exam you can write “+ constant”.
In the picture, the gusts log-likelihood: a hill with its top at 3.21, where the tangent is horizontal (). On the left the slope is positive and on the right negative: that is what says, that the slope always goes down.
The case (no rainy days). Then , which is largest at , and the derivative is not zero anywhere in (0, 1). The MLE is still , but you see it by drawing, not by differentiating. Same with .
Result for the cheat sheet. Bernoulli: . Poisson: . They coincide with the moments ones.
Check it in R
lb <- function(p) sum(dbinom(rains, 1, p, log = TRUE)) # Bernoulli = binom(1, p) lp <- function(l) sum(dpois(gusts, l, log = TRUE)) c(p_formula = mean(rains), p_optimize = optimize(lb, c(0.001, 0.999), maximum = TRUE)$maximum, l_formula = mean(gusts), l_optimize = optimize(lp, c(0.1, 20), maximum = TRUE)$maximum)
Output:
p_formula p_optimize l_formula l_optimize 0.3000000 0.2999945 3.2083333 3.2083498
optimize finds the same maxima as the formula, with a few decimals of difference that are the algorithm’s tolerance (by default, about four figures).
Check you’ve got it: in the Bernoulli, what would happen if you differentiated L(p) directly, without taking logarithms?
You would get the same thing with much more work. By the product rule, ; taking out the common factor leaves , which is zero at , the same point (rule 6). But the second derivative would be a mess. The logarithm turns the product into a sum, which you differentiate term by term.
Proof 4: MLE of the exponential and the Rayleigh
What we want to prove
Why it matters. Here, for the first time, the two methods disagree: with the wind, moments gave 94.21 and maximum likelihood gives 93.14. And it is the first case where depends on the parameter. The exponential goes first as a warm-up.
Step 1: the exponential
Why: n factors λ give , and the n exponentials merge into (rule 3). Taking logarithms, rule 2 brings the n down and removes the e.
Step 2: the Rayleigh likelihood
With :
by rule 3: the n denominators α come together as and the n exponentials, as one with the sum of the exponents.
Step 3: log and derivative
The first term does not depend on α. By rule 4, , so with the minus sign it turns positive:
To combine the fractions, . Since , the derivative is 0 only when the numerator is 0.
Step 4: the second derivative
Where it comes from: and, by rule 4, .
Here the sign is not negative on the whole domain: it depends on α. You evaluate it at , using :
Maximum. And since for and for (look at the numerator ), it is the only one.
Writing instead of . They are not the same: with the wind, and . In R, sum(wind^2) against sum(wind)^2: the brackets change everything.
Result for the cheat sheet. exp(λ): . Rayleigh(α): .
Check it in R
lr <- function(a) sum(log(wind / a) - wind^2 / (2 * a)) # l(alpha) with all its terms c(formula = sum(wind^2) / (2 * length(wind)), optimize = optimize(lr, c(10, 500), maximum = TRUE)$maximum, second = -length(wind) / (sum(wind^2) / 80)^2)
Output:
formula optimize second 93.144250000 93.144245019 -0.004610499
The function lr includes (it is inside log(wind / a)), but since it does not depend on α it does not move the maximum: optimize gives 93.144 all the same. The second derivative at the maximum, , is negative and small: the hill is wide, another way of saying that α is not very precise with 40 data points.
Check you’ve got it: in step 3, why does the term with the logarithms of the data vanish when differentiating?
Because you differentiate with respect to α. Once the sample is taken, is a fixed number, like a 7: its derivative with respect to α is 0. That is why optimize gives 93.144 even though lr includes it. It changes the height of the hill, not where its top is.
Proof 5: MLE of the normal with μ and σ unknown
What we want to prove
If is a simple random sample from an with both parameters unknown:
And two cases with one parameter known: if σ is known, ; if μ = μ₀ is known, .
Why it matters. It is the first one with two parameters at once, and the one that comes up most. It has a catch: divides by n, not by , so the MLE of σ is not sd().
Where we start
From the density . With two parameters, you differentiate with respect to each, set to 0 and solve the system.
Step 1: the log-likelihood
From L to ℓ: gives , gives (rule 2), and the logarithm leaves the exponent of the e as it is.
Step 2: the equation for μ
What gets skipped: the derivative of is times , the derivative of the inside. The 2 cancels with the one in the denominator and the two minus signs cancel out.
Since , the sum has to be 0: . Notice it does not depend on σ: whatever σ is, the best μ is the mean.
Step 3: the equation for σ
(the derivative of is ). Multiplying by : .
The arithmetic: . You can multiply by because : it neither adds nor removes solutions.
Step 4: solve the system
Substitute in the second equation:
If μ = μ₀ is known, in step 3 there is nothing to substitute: .
Step 5: is it a maximum?
With two variables you argue in two stages. For each fixed σ, is a downward parabola in μ (), with its maximum at . Then at , as a function of σ:
In the picture, the two slices of the log-likelihood with the 15 nights: on the left, with σ fixed at , peaking at °C; on the right, with μ fixed at , peaking at °C, steeper on the left (a small σ makes the far data impossible) than on the right.
Step 6: and the gamma, why not?
With the gamma(α, β) of the rain you do the same, but the system cannot be solved:
Substituting the first into the second leaves , with (the digamma). There is no way to solve for α by hand: it is solved with optim or fitdist. What can be proved is that : the gamma fitted by maximum likelihood has the same mean as the data.
Differentiating with respect to in one place and to σ in another. Pick one variable and stick to it: if you differentiate with respect to , and you get just the same (invariance guarantees ).
Result for the cheat sheet. Normal: , (divides by n); with μ₀ known, . Gamma: no closed form, optim/fitdist, with .
Check it in R
ln <- function(par, x) sum(dnorm(x, mean = par[1], sd = par[2], log = TRUE))
o <- optim(c(10, 1), ln, x = tnight, method = "L-BFGS-B",
lower = c(-Inf, 0.01), control = list(fnscale = -1))
round(c(mu_optim = o$par[1], sigma_optim = o$par[2],
mu_formula = mean(tnight), sigma_formula = sqrt(s2p(tnight)),
sd_from_R = sd(tnight)), 3)
Output:
mu_optim sigma_optim mu_formula sigma_formula sd_from_R
14.047 2.204 14.047 2.204 2.281
optim, starting far away (μ = 10, σ = 1), reaches the formulas: and . Look at the last column: sd() gives 2.281, because it divides by n − 1. The MLE of σ is not sd().
Check you’ve got it: if you knew the mean of the nights is 15 °C, would the MLE of σ be larger or smaller than 2.20?
Larger: 2.40 °C. With μ₀ known, , and it always holds that : . Measuring from a center that is not the mean always gives more spread.
Proof 6: MLE of the uniform(0, θ), without differentiating
What we want to prove
If is a simple random sample from a uniform(0, θ), then
Why it matters. It is the practice-exam case: the recipe fails with no arithmetic mistake at all. It happens whenever the support depends on the parameter, and in the exam it is set to see whether you think before differentiating.
Where we start
From the density if and 0 otherwise. The support depends on θ: that is the clue that the derivative will not help.
Step 1: the likelihood with its condition
Each factor is if the data point falls in and 0 if not. The product is only if all fall inside, that is, if for every i, which is the same as :
I is the indicator function: 1 if the condition holds, 0 if not.
Why: if the largest data point fits in , so do the rest. If it does not fit, its factor is 0 and wipes out the product.
Step 2: why differentiating does not work
Where L is not 0, and , which is always negative: the likelihood keeps going down. The equation has no solution (the one that froze me in the practice exam). The derivative is not zero because the maximum is not a “smooth” point: it is a corner.
Step 3: reason with the picture
In the picture, the 15 delays on a line. θ is the end of the interval; it has to be to the right of all the points (allowed zone, in green). Inside the allowed zone, the smaller θ, the larger . The smallest allowed θ is the last point: s.
Saying the maximum of is “at θ = 0” because the function shoots up there. θ = 0 is not allowed: it would make every data point impossible. The likelihood’s maximum is at the sample maximum.
Result for the cheat sheet. Uniform(0, θ): (moments: ). Whenever the support depends on the parameter, the MLE is an extreme of the sample.
Check it in R
Lu <- function(th) ifelse(th >= max(delay), th^(-15), 0) # the whole likelihood grid <- seq(3, 5, by = 0.001) c(grid_maximum = grid[which.max(Lu(grid))], data_max = max(delay), moments = 2 * mean(delay), L_at_3.739 = Lu(3.739))
Output:
grid_maximum data_max moments L_at_3.739
3.740000 3.740000 3.933333 0.000000
Searching on a grid of θ every thousandth, the maximum of L falls at 3.74, the data maximum. Just to the left (3.739) the likelihood is already 0. And by moments, 3.93: to the right of the maximum this time, but not always (in the practice, in a good 30 % of samples it lands to the left).
Check you’ve got it: if tomorrow a delay of 3.90 s comes in, how does the MLE of θ change? And if one of 2.00 s comes in?
With 3.90, becomes 3.90: θ has to cover the new maximum. With 2.00 it stays at 3.74, because that point already falls inside. The MLE only listens to the largest data point; the moments one, , moves with both: from 3.93 to 4.18 and to 3.94.
Proof 7: invariance and the distribution of the Rayleigh MLE
What we want to prove
Two things. First, the invariance principle: if is the MLE of θ, the MLE of is . Second, what the random variable of the Rayleigh looks like:
Why it matters. With invariance you get the MLE of any function of α without differentiating again. And the second part is a reminder that an estimator changes with every sample: its distribution gives its mean and variance, which the next topic uses to decide whether it is good.
Step 1: invariance, when τ is one-to-one
If τ is one-to-one (for example , the mean wind speed), rewrite the likelihood in terms of η: . The values takes are exactly those of L, just with another label on the axis. Its maximum is reached at the η whose “original label” is , that is, at . The general theorem (τ not one-to-one) is proved the same way by defining the induced likelihood; in ME1 it is used without proof.
With the wind: the MLE of the mean wind speed is km/h, and that of is .
Step 2: the distribution of Y = X²
If X is Rayleigh(α), has distribution function, for ,
(the derivative of is exactly ). It is the distribution function of an exponential with rate : , with mgf for .
Two whys. is the same as because X is not negative. And the mgf of an is : with , multiplying top and bottom by , you get .
Step 3: the sum
The are independent (the are), so the mgf of is the product:
which is the mgf of a .
Why: the mgf of a sum of independent variables is the product of their mgfs; n equal factors give a power n, and is the mgf of a gamma(n, b).
Step 4: divide by 2n
. For a constant c, :
the mgf of a . By rule 8, its mean is and its variance .
Why : , which is evaluated at ct.
In the picture, the whole chain: from a Rayleigh to an exponential (squaring), from n exponentials to a gamma (adding), and from that gamma to another (dividing by 2n). Under each arrow, what changes in the mgf.
For the curious. That means the estimator does not systematically miss α: some samples overestimate it and others underestimate it, but on average it hits. This is called being unbiased, and it is the first thing in the next topic. That goes down with n says that with more data it concentrates around α.
Result for the cheat sheet. Invariance: MLE of = . Rayleigh: , , .
Check it in R
We simulate 10,000 samples of 40 readings from a Rayleigh with α = 94 (a Rayleigh is simulated as , with U uniform) and compute in each:
set.seed(9)
alphas <- replicate(10000, {
x <- sqrt(-2 * 94 * log(runif(40))) # 40 readings from a Rayleigh(94)
sum(x^2) / 80 # its MLE
})
round(c(mean = mean(alphas), theoretical = 94, var = var(alphas), var_theoretical = 94^2 / 40), 2)
hist(alphas, freq = FALSE, breaks = 40, main = "10,000 MLEs of alpha", xlab = "alpha")
curve(dgamma(x, 40, 40 / 94), add = TRUE, lwd = 2)
Output:
mean theoretical var var_theoretical
94.13 94.00 223.13 220.90
The mean of the 10,000 MLEs is 94.13, practically α = 94, and their variance 223.13 against the theoretical : the difference is simulation noise. In the picture, the histogram fits the gamma(40, 0.43) from the proof: slightly skewed right (MLEs of 120 are more likely than ones of 68), centred on 94. Our 93.14 is one of those 10,000 points, quite close to the center.
Check you’ve got it: with 160 readings instead of 40, what distribution would the MLE of α have, and what would its standard deviation be if α = 94?
A gamma(160, 160/94), centred on 94. Its variance is , so its standard deviation is , half of what it is with 40 readings (14.86). Four times as much data, half the spread.
Prove it yourself
Three new proofs, with their solution folded away. Try each one on paper before opening it.
1. The geometric. The number of correct readings the station takes before the first sensor failure is geometric: , Find the MLE of p and check that it is a maximum.
Show the solution
, with . By rules 1 and 2, .
(dividing top and bottom by n).
always: maximum. By moments you get the same, because and solving also gives .
2. Probability of an hour with no gusts. With the gusts Poisson(λ), find the MLE of the probability that an hour has no strong gust, and compute it with the data ().
Show the solution
. By proof 3, , and by the invariance principle (proof 7), the MLE of is .
With the data: . We estimate that 4 % of hours have no strong gust. In the sample, none of the 24 hours had 0, which with 4 % is to be expected (the usual would be 1 in 24).
3. The shifted exponential. The time the station takes to restart after a power cut has density for (it never takes less than θ seconds). Find the MLE and the moments estimator of θ.
Show the solution
Maximum likelihood. if for every i, that is, if ; and 0 otherwise. Where it is not 0, grows with θ. So the maximum is at the largest allowed θ: . As in the uniform, the derivative () is never zero: the maximum is at an edge.
Moments. is an exponential with rate 1 (change ), so . Matching: . It can come out larger than the smallest data point, and then it would make that point impossible.
When to use each result
| If you are asked for… | Use | Watch out for… |
|---|---|---|
| The moments estimator of one parameter | and solve | Getting right (integral with a change, like the Rayleigh) |
| The moments estimator of two parameters | Mean and variance: , | divides by n, not var() |
| The MLE of a “nice” distribution (differentiable, fixed support) | The four steps: L, ℓ, ℓ’ = 0, ℓ” < 0 | Terms that do not depend on the parameter vanish when differentiating |
| The MLE with two parameters | Partial derivatives and a system | If it cannot be solved (gamma, beta, two-parameter Weibull), optim or fitdist |
| The MLE when the support depends on θ | Draw L and reason | The maximum is an extreme of the sample (max or min) |
| The MLE of a function of the parameter | Invariance: | Only valid for MLEs, not for moments |
| The distribution of the MLE | Change of variable and mgf (sum of independents) |
Common mistakes when proving
- Confusing with . In the Rayleigh, the normal with μ known or the variance, the square goes inside the sum.
- Forgetting the second derivative. It is marked separately in the exam. If depends on the parameter, evaluate it at (as in the Rayleigh).
- Differentiating when the support depends on the parameter. Uniform(0, θ), shifted exponential, on : first the picture of L.
- Dragging constants along. , , do not depend on the parameter: write “+ c” and move on.
- Using instead of in moments and in the MLE of the normal’s σ².
- Solving wrongly when dividing equations in the two-parameter moments system: divide the mean equation by the variance one, not the other way round, and check by substituting.
Try it in the R playground
Open the R playground on the site (or RStudio) and paste this script, which checks with simulation the hardest point of the article: that the uniform MLE never overshoots the parameter while the moments one does.
set.seed(1)
theta <- 4; n <- 15
est <- replicate(10000, {
x <- runif(n, 0, theta)
c(ml = max(x), mm = 2 * mean(x), largest = max(x))
})
rowMeans(est[1:2, ]) # mean of each estimator
mean(est["mm", ] < est["largest", ]) # moments below the largest data point
mean(est["ml", ] > theta) # maximum likelihood above theta
hist(est["ml", ], breaks = 40, main = "MLE of theta = max(x)", xlab = "theta")
Things to look at:
rowMeans: the mean of the MLE comes out a little below 4 (it can never overshoot) and the moments one, almost exactly 4.- The proportion of samples where the moments estimator falls below the largest data point: more than a third. It is an estimator that is sometimes impossible.
mean(est["ml", ] > theta)gives 0: the sample maximum never exceeds θ.- The histogram: everything pressed to the left of 4, with a wall at 4. Change
n <- 15ton <- 60and see how it presses closer.
Summary
| Distribution | Moments | Maximum likelihood | How you get there |
|---|---|---|---|
| Rayleigh(α) | Integral with ; derivative and ℓ” at | ||
| Gamma(α, β) | , | optim/fitdist | Moments system; digamma, no closed form |
| Uniform(a, b) | — | Mean and variance | |
| Bernoulli(p) | on all of (0, 1) | ||
| Poisson(λ) | (or ) | The constant vanishes | |
| exp(λ) | |||
| Normal(μ, σ) | , | , | System of two equations |
| Uniform(0, θ) | No derivative: the edge |
Three ideas to take away:
- The recipe is L, log, derivative, second derivative. The log turns products into sums and does not move the maximum; constants vanish when differentiating.
- If the support depends on the parameter, do not differentiate: draw. The maximum is at an extreme of the sample.
- The MLE is a random variable with its distribution. With a change of variable and the mgf you get it (the Rayleigh gives a gamma), and from there its mean and variance, which is what measures whether an estimator is good.
Now it is time to do it on the computer: in the point estimation practice in R you estimate the station’s series, draw likelihoods and fit the rain with optim and fitdist. And in the point estimation exercises you have these proofs as the first part of exam-style exercises.
Did this article help you? Here is how you can support SergioLearns →



