I would like to find the 95% CI for the MLE for my parameter in a function but I have no idea how.
The given function is a power-law distribution with
f(x)=Cx^(-mu),
I calculated the MLE for mu using the bbmle package in R.
Some people on the internet say use profile likelihood to do it but I am not sure how to in R, or other methods which lead to the same results are fine too.
Much appreciate and thanks in advance!
Update:
load("fakedata500.Rda")
> library(stats4)
> library(bbmle)
> x<-fakedata500
> pl <- function(u){-length(x)*log(u-1)-length(x)*(u-1)*log(min(x))+u*sum(log(x))}
mle1<-mle2(pl, start=list(u=2), data=list(x))
> summary(mle1)
Maximum likelihood estimation
Call:
mle2(minuslogl = pl, start = list(u = 2), data = list(x))
Coefficients:
Estimate Std. Error z value Pr(z)
u 2.00510 0.04495 44.608 < 2.2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
-2 log L: 1300.166
So the estimated mu is 2.00510 and I would like to get the 95% CI of it, it might look nonsense since my started mu was 2 so 2.00510 is very close to it, but I am going to apply this method to other data sets too which I havn't come across yet so really hope to find a way to do it.
(Converted from a comment.)
If you're using mle2
from the bbmle
package you should just be able to say confint(mle1)
to get the 95% profile confidence intervals. See ?confint.mle2
, or try vignette("mle2",package="bbmle")
and search for "confint" for more information.