On 2011-2-6 22:56, Ben Bolker wrote:
Jinsong Zhao<jszhao<at> yeah.net> writes:
Hi there,
I have fitted a sample (with size 20) to a normal and/or logistic
distribution using fitdistr() in MASS or fitdist() in fitdistrplus
package. It's easy to get the parameter estimates. Now, I hope to report
the confidence interval for those parameter estimates. However, I don't
find a function that could give the confidence interval in R.
I hope to write a function, however, I don't find some detailed
information on the CI based on MLE. Would you please to give me some
hints on the CI calculation based on MLE?
Well, for the normal distribution I believe that the standard-error-
based confidence intervals are the same as those based on the MLE,
but in general I would suggest something along these lines:
library(bbmle)
z<- rnorm(20)
m<- mle2(z~dnorm(mean=mu,sd=sd),start=list(mu=0,sd=1),data=data.frame(z))
Warning message:
In dnorm(x, mean, sd, log) : NaNs produced
confint(m)
Profiling...
2.5 % 97.5 %
mu -0.07880835 0.985382
sd 0.87314467 1.633600
Thank you very much for your kindly help and the way to get MLE through
bbmle package. It works well.
I have a interval related question. I have a sample data set, with size
20 or less. And I fit it to a three parameter distribution, e.g., a
triangular distribution (oops, it cannot fitted by mle2 :-(). I get the
quantile, q, for a given probability, p. Then, I hope to get the
confidence (or prediction?) interval for the quantile, q. However, I
don't know how to do.
I refer to some books on ecological data analysis. There's a explicit
formula for CI to the normal distribution's q, based on delta method or
Fieller's theorem. (And I think they should work for logistic
distribution). But I don't find any thing that for other distribution.
BTW, is it possible to get a interval of p for a given q? Although, it's
not a normal way in the view of statistics, it has a lot applications.
Any suggestions or comments will be really appreciated. Thanks in advance.
Regards,
Jinsong
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.