问题
I have defined a mixture of a LogNormal and a Generalised Pareto (actuar) as follows:
dlnormgenpar<-function(x,
w_lnorm,
meanlog=0,
sdlog=1,
par_shape1=1,
par_shape2=1,
par_scale=1) {
w_par=1-w_lnorm
dln=dlnorm(x,meanlog = meanlog,sdlog = sdlog)
dpar=dgenpareto(x,shape1=par_shape1,shape2=par_shape2,scale=par_scale)
return(w_lnorm*dln+w_par*dpar)
}
I am trying to fit it to some data using fistdistrplus:
dist<-fitdist(data,"lnormgenpar")
However I receive the error:
Unknown starting values for distribution lnormgenpar.
If I expand the fitting function in the usual fitdistrplus way the error remains:
dist<-fitdist(data,"lnormgenpar",dparams=list(
w_lnorm=0.5,
meanlog=0,
sdlog=1,
par_shape1=1,
par_shape2=1,
par_scale=1
))
How should I pass my parameters in to the fitting function?
Thanks
Simon
来源:https://stackoverflow.com/questions/33942202/r-fitting-a-mixture-distribution-with-fitdistrplus