这个问题太困扰了我......这是我的R程序:
x<-c(0.06,2.8441,540,1.1,4.974,509.8,66,800.14,3670,762.2336,0.05,2880,2.4514,1235.921,0.57,0.2,270,159.2482,3.6,769,4.65,280,0.1876,0.3,0.07,2200,0.0695,3970,280,138,1050.952,287.2281,5.7128,0.77,2.964,10.2,3.4849,2.7415,1000,1.3796,13.6403,9.3983,322.371,0.8,0.89,110.3466,2,0.38,10,136.0477,0.4,348.8425,148,52,117,240,1350.358)
y=log10(x)
# location and scale based on the y
y.n<-length(y)
y.location<-mean(y)
y.var<-(y.n-1)/y.n*var(y)
y.scale<-sqrt(3*y.var)/pi
# load the stats4 package
library(stats4)
# function to calculate negative log-likelihood
ll.logis <- function(location=y.location, scale=y.scale){
-sum(dlogis(y, location, scale, log = TRUE))
}
# fitting logistic distribution using mle function
fit.mle <- mle(ll.logis, method="Nelder-Mead")
# the estimation of parameter
fit.location <- coef(fit.mle)[1]
fit.scale <- coef(fit.mle)[2]
现在,我希望得到这样的Fitting图像,enter image description here 我应该写什么代码?谢谢!