Hi Rolf,

I fit 3 parameters lognormal in this way

myf<-function(x,m,s,t)(1/((x-t)*s*(2*pi)^0.5))*exp(((-(log(x-t)-m)^2)/(2*s^2)))

then fitdistr(y, myf, list(m=1,s=1, t=2))

I choose initial parameters value seeing data, I noted that a goog estimate of t would be 2...Me too I've some errors, having NA in log function.

Best regards.
Vito


 
Se non ora, quando?
Se non qui, dove?
Se non tu, chi?



Il Venerdė 17 Gennaio 2014 22:46, Rolf Turner <r.turner@auckland.ac.nz> ha scritto:
 

>Can you please tell us (me!) how you chose starting values?
>
>Out of curiosity I tried the following:
>
>set.seed(42)
>x <- rlnorm(100,1,2) + 3
>require(MASS)
>strt <- list(mu=1,sigma=2,gamma=3)
>fit  <- fitdistr(x,densfun=function(x,mu,sigma,gamma)
>                                   {dlnorm(x-gamma,mu,sigma)
>                           },
>                start=strt,lower=c(0,0,-Inf),
>                upper=c(Inf,Inf,min(x)))
>
>and it ran just fine and gave sensible answers.  But when I took:
>
>strt <- list(mu=0.9,sigma=1.9,gamma=2.9)
>
>(not very different from the previous starting values)
>
>I got an error:
>
>> Error in stats::optim(x = c(45.178764955739, 3.87862565957867, 8.61957940802123,  :
>>   L-BFGS-B needs finite values of 'fn'
>
>
>
>On 18/01/14 01:00, Vito Ricci wrote:
>> OK. It runs fine! Many thanks Frede.
>> Regards.
>> Vito
>>
>>
>>
>> Se non ora, quando?
>> Se non qui, dove?
>> Se non tu, chi?
>>
>>
>>
>> Il Venerdė 17 Gennaio 2014 12:38, Frede Aakmann Tøgersen <frtog@vestas.com> ha scritto:
>>
>>
>>> In package MASS there is the fitdistr function using maximum likelihood estimation to infer on the parameters of distributions based on observed data.
>>>
>>>
>>> One of the arguments of fitdistr () allows you to specify the probability density function.
>>>
>>>
>>> You only know how the parametrization of your three parameters lognormal distribution is defined since you really haven't told us much.
>>>
>>>
>>> Please have a look at fitdistr() and tell us if fit your needs.
>
>
>
>
	[[alternative HTML version deleted]]


