Re: [R] Estimating parameters of 3 parameters lognormal distribution

2014-01-18 Thread Rolf Turner

On 19/01/14 06:20, peter dalgaard wrote:

Offhand, I'd say that the issue isn't so much the starting values as the risk of 
hitting the upper bound on gamma. If you get gamma set to min(x) at any point during 
the iteration, the density at the corresponding point is zero, the log-likelihood is 
-Inf, and , the magic smoke escapes.

Perhaps try min(x)-1e-7 or so?


Yep, that did it.  Thanks Peter.

(Actually I used min(x) - eps where I set eps equal to 
sqrt(.Machine$double.eps) --- which seems to be a kind of standard 
construction for a small-but-not-too-small number.)


cheers,

Rolf

__
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.


Re: [R] Estimating parameters of 3 parameters lognormal distribution

2014-01-18 Thread peter dalgaard
Offhand, I'd say that the issue isn't so much the starting values as the risk 
of hitting the upper bound on gamma. If you get gamma set to min(x) at any 
point during the iteration, the density at the corresponding point is zero, the 
log-likelihood is -Inf, and , the magic smoke escapes. 

Perhaps try min(x)-1e-7 or so?

-pd

On 17 Jan 2014, at 22:46 , Rolf Turner  wrote:

> 
> 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  
>> 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.
> 
> __
> 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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
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.


Re: [R] Estimating parameters of 3 parameters lognormal distribution

2014-01-18 Thread Vito Ricci
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  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  
>> 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]]

__
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.


Re: [R] Estimating parameters of 3 parameters lognormal distribution

2014-01-18 Thread Prof Brian Ripley

On 18/01/2014 09:06, Frede Aakmann Tøgersen wrote:

It has to do with setting a to large upper bound for the gamma
parameter. However, we are estimating the value of gamma because we
do not know it so how can we set an upper bound for gamma??


You have starting values, so have some idea of the MLE 


Perhaps other optimization algorithms in optim() can be used
(Nelder-Mead works for this x at least).


The parameters could be transformed here, and probably should.  But most 
optimization methods are going to cope with such simple constraints 
provided foo() returns NA outside the feasible region.



Here is my findings:


N <- 100
mu <-  1
sigma <- 2
gamma <- 3

set.seed(42)
x <- rlnorm(N, mu, sigma) + gamma

min(x)

[1] 3.006832


foo <- function(x, mu, sigma, gamma)

+ {dlnorm(x - gamma, mu, sigma)}


## min(x) is not the right upper bound to use for gamma
fit  <- fitdistr(x, densfun = foo,

+ start = list(mu = 0.9, sigma = 1.9, gamma = 2.9),
+ lower = c(-Inf, 0, -Inf),
+ upper=c(Inf, Inf, min(x)))
Error in stats::optim(x = c(45.178764955739, 3.87862565957867, 
8.61957940802123,  :
   L-BFGS-B needs finite values of 'fn'


## now upper bound for gamma is not to large
fit  <- fitdistr(x, densfun = foo,

+ start = list(mu = 0.9, sigma = 1.9, gamma = 2.9),
+ lower = c(-Inf, 0, -Inf),
+ upper=c(Inf, Inf, 3))

fit

mu sigmagamma
   1.08694600   2.02546254   2.99393215
  (0.20902998) (0.17736860) (0.01663611)


## now upper bound for gamma is not to large
## still able to find correct estimates for parameters for other start values
fit  <- fitdistr(x, densfun = foo,

+ start = list(mu = 0, sigma = 1, gamma = 0),
+ lower = c(-Inf, 0.0001, -Inf),
+ upper=c(Inf, Inf, 3))

fit

mu sigmagamma
   1.08671881   2.02579806   2.99394094
  (0.20907178) (0.17745706) (0.01663591)


## Nelder-Mead method seems to do the job
fit  <- fitdistr(x, densfun = foo, method = "Nelder-Mead",
start = list(mu = 0, sigma = 1, gamma = 0))
fit

mu sigmagamma
   1.08678997   2.02571374   2.99393924
  (0.20906041) (0.17743258) (0.01663503)


## these two functions are defined and used in the code for fitdistr
## myfn is the objective function to be optimized in optim()
dens <- function(parm, ...) foo(x, parm, ...)
myfn <- function(parm, ...) -sum(log(dens(parm, ...)))

## for gamma > 3. Here min(x) = 3.006832
## have at least one illegal value of log-normal
table(dens(1, 2, min(x)) > 0)


FALSE  TRUE
 199


## resulting in
myfn(0.9, 1.9, min(x))

[1] Inf

## but for gamma = 3 we get finite likelihood
myfn(0.9, 1.9, 3.00)

[1] 322.4375

## also finite likelihood
myfn(0.9, 1.9, -3.00)

[1] 456.7857




Yours sincerely / Med venlig hilsen


Frede Aakmann Tøgersen
Specialist, M.Sc., Ph.D.
Plant Performance & Modeling

Technology & Service Solutions
T +45 9730 5135
M +45 2547 6050
fr...@vestas.com
http://www.vestas.com

Company reg. name: Vestas Wind Systems A/S
This e-mail is subject to our e-mail disclaimer statement.
Please refer to www.vestas.com/legal/notice
If you have received this e-mail in error please contact the sender.



-Original Message-
From: Rolf Turner [mailto:r.tur...@auckland.ac.nz]
Sent: 17. januar 2014 22:47
To: Vito Ricci
Cc: Frede Aakmann Tøgersen; Göran Broström; r-h...@stat.math.ethz.ch
Subject: Re: [R] Estimating parameters of 3 parameters lognormal
distribution


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

 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 s

Re: [R] Estimating parameters of 3 parameters lognormal distribution

2014-01-18 Thread Frede Aakmann Tøgersen
It has to do with setting a to large upper bound for the gamma parameter. 
However, we are estimating the value of gamma because we do not know it so how 
can we set an upper bound for gamma??

Perhaps other optimization algorithms in optim() can be used (Nelder-Mead works 
for this x at least).

Here is my findings:

> N <- 100
> mu <-  1
> sigma <- 2 
> gamma <- 3
> 
> set.seed(42)
> x <- rlnorm(N, mu, sigma) + gamma
> 
> min(x)
[1] 3.006832
> 
> foo <- function(x, mu, sigma, gamma)
+ {dlnorm(x - gamma, mu, sigma)}
> 
> ## min(x) is not the right upper bound to use for gamma
> fit  <- fitdistr(x, densfun = foo,
+ start = list(mu = 0.9, sigma = 1.9, gamma = 2.9),
+ lower = c(-Inf, 0, -Inf),
+ upper=c(Inf, Inf, min(x)))
Error in stats::optim(x = c(45.178764955739, 3.87862565957867, 
8.61957940802123,  : 
  L-BFGS-B needs finite values of 'fn'
> 
> ## now upper bound for gamma is not to large
> fit  <- fitdistr(x, densfun = foo,
+ start = list(mu = 0.9, sigma = 1.9, gamma = 2.9),
+ lower = c(-Inf, 0, -Inf),
+ upper=c(Inf, Inf, 3))
> fit
   mu sigmagamma   
  1.08694600   2.02546254   2.99393215 
 (0.20902998) (0.17736860) (0.01663611)
> 
> ## now upper bound for gamma is not to large
> ## still able to find correct estimates for parameters for other start values
> fit  <- fitdistr(x, densfun = foo,
+ start = list(mu = 0, sigma = 1, gamma = 0),
+ lower = c(-Inf, 0.0001, -Inf),
+ upper=c(Inf, Inf, 3))
> fit
   mu sigmagamma   
  1.08671881   2.02579806   2.99394094 
 (0.20907178) (0.17745706) (0.01663591)
> 
> ## Nelder-Mead method seems to do the job
> fit  <- fitdistr(x, densfun = foo, method = "Nelder-Mead",
>start = list(mu = 0, sigma = 1, gamma = 0))
> fit
   mu sigmagamma   
  1.08678997   2.02571374   2.99393924 
 (0.20906041) (0.17743258) (0.01663503)
> 
> ## these two functions are defined and used in the code for fitdistr
> ## myfn is the objective function to be optimized in optim()
> dens <- function(parm, ...) foo(x, parm, ...)
> myfn <- function(parm, ...) -sum(log(dens(parm, ...)))
> 
> ## for gamma > 3. Here min(x) = 3.006832
> ## have at least one illegal value of log-normal
> table(dens(1, 2, min(x)) > 0)

FALSE  TRUE 
199 
>  
> ## resulting in
> myfn(0.9, 1.9, min(x))
[1] Inf
> ## but for gamma = 3 we get finite likelihood
> myfn(0.9, 1.9, 3.00)
[1] 322.4375
> ## also finite likelihood
> myfn(0.9, 1.9, -3.00)
[1] 456.7857
>

Yours sincerely / Med venlig hilsen


Frede Aakmann Tøgersen
Specialist, M.Sc., Ph.D.
Plant Performance & Modeling

Technology & Service Solutions
T +45 9730 5135
M +45 2547 6050
fr...@vestas.com
http://www.vestas.com

Company reg. name: Vestas Wind Systems A/S
This e-mail is subject to our e-mail disclaimer statement.
Please refer to www.vestas.com/legal/notice
If you have received this e-mail in error please contact the sender. 


> -Original Message-
> From: Rolf Turner [mailto:r.tur...@auckland.ac.nz]
> Sent: 17. januar 2014 22:47
> To: Vito Ricci
> Cc: Frede Aakmann Tøgersen; Göran Broström; r-h...@stat.math.ethz.ch
> Subject: Re: [R] Estimating parameters of 3 parameters lognormal
> distribution
> 
> 
> 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
>  ha scritto:
> >
> >
> >> In package MASS there is the fitdistr function using maximum likelihood
> estimation to infer on the parameters of 

Re: [R] Estimating parameters of 3 parameters lognormal distribution

2014-01-17 Thread Rolf Turner


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  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.


__
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.


Re: [R] Estimating parameters of 3 parameters lognormal distribution

2014-01-17 Thread Frede Aakmann Tøgersen
Really, the thanks go to Prof. Ripley et al, maintainig that package.

Br. Frede


 Oprindelig meddelelse 
Fra: Vito Ricci
Dato:17/01/2014 13.00 (GMT+01:00)
Til: Frede Aakmann Tøgersen ,Göran Broström ,r-h...@stat.math.ethz.ch
Emne: Re: [R] Estimating parameters of 3 parameters lognormal distribution

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  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.

Br. Frede


 Oprindelig meddelelse 
Fra: Vito Ricci
Dato:17/01/2014 08.44 (GMT+01:00)
Til: Göran Broström ,r-h...@stat.math.ethz.ch
Emne: Re: [R] Estimating parameters of 3 parameters lognormal distribution

Hi Goran,

thanks for your suggestion, but I believe it's not helpful for me...

phreg statement "Proportional hazards model with parametric baseline hazard(s). 
 Allows for stratification with dif-ferent scale and shape in each stratum, and 
left truncated and right censored data"

I've data whose distribution is lognormal with three parameters, I need to fit 
this model and its 3 parameters, especially the the 3rd, the theresold.
Regards.
VR



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



Il Venerdì 17 Gennaio 2014 8:26, Vito Ricci  ha scritto:

Many thanks for your suggestion.
>Regards.
>VR
>
>
>
>
>Se non ora, quando?
>Se non qui, dove?
>Se non tu, chi?
>
>
>
>Il Giovedì 16 Gennaio 2014 22:31, Göran Broström  ha 
>scritto:
>
>On 01/16/2014 04:59 PM, Vito Ricci wrote:
>>> Hi guys,
>>>
>>> is there in some R package a statement to fit parameters in a 3 parameters 
>>> lognormal distribution.
>>
>>Yes, the function 'phreg' in the package 'eha'.
>>
>>Göran Broström
>>
>>
>>
>>> Many thanks
>>> Vito Ricci
>>> [[alternative HTML version deleted]]
>>>
>>> __
>>> 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<http://www.r-project.org/posting-guide.html>
>>> and provide commented, minimal, self-contained, reproducible code.
>>
>>>
>>
>>
>>
>
>
[[alternative HTML version deleted]]




[[alternative HTML version deleted]]

__
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.


Re: [R] Estimating parameters of 3 parameters lognormal distribution

2014-01-17 Thread Vito Ricci
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  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. 
>
>
>Br. Frede 
>
> Oprindelig meddelelse 
>Fra: Vito Ricci 
>Dato:17/01/2014 08.44 (GMT+01:00) 
>Til: Göran Broström ,r-h...@stat.math.ethz.ch 
>Emne: Re: [R] Estimating parameters of 3 parameters lognormal distribution 
>
>Hi Goran,
>
>thanks for your suggestion, but I believe it's not helpful for me...
>
>phreg statement "Proportional hazards model with parametric baseline 
>hazard(s).  Allows for stratification with dif-ferent scale and shape in each 
>stratum, and left truncated and right censored data"
>
>I've data whose distribution is lognormal with three parameters, I need to fit 
>this model and its 3 parameters, especially the the 3rd, the theresold.
>Regards.
>VR
>
>
> 
>Se non ora, quando?
>Se non qui, dove?
>Se non tu, chi?
>
>
>
>Il Venerdì 17 Gennaio 2014 8:26, Vito Ricci  ha scritto:
> 
>Many thanks for your suggestion.
>>Regards.
>>VR
>>
>>
>>
>> 
>>Se non ora, quando?
>>Se non qui, dove?
>>Se non tu, chi?
>>
>>
>>
>>Il Giovedì 16 Gennaio 2014 22:31, Göran Broström  ha 
>>scritto:
>> 
>>On 01/16/2014 04:59 PM, Vito Ricci wrote:
>>>> Hi guys,
>>>>
>>>> is there in some R package a statement to fit parameters in a 3 parameters 
>>>> lognormal distribution.
>>>
>>>Yes, the function 'phreg' in the package 'eha'.
>>>
>>>Göran Broström
>>>
>>>
>>>
>>>> Many thanks
>>>> Vito Ricci
>>>>     [[alternative HTML version deleted]]
>>>>
>>>> __
>>>> 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.
>>>
>>>>
>>>
>>>
>>>
>>
>>
>    [[alternative HTML version deleted]]
>
> 
>
>
[[alternative HTML version deleted]]

__
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.


Re: [R] Estimating parameters of 3 parameters lognormal distribution

2014-01-17 Thread Frede Aakmann Tøgersen
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.

Br. Frede


 Oprindelig meddelelse 
Fra: Vito Ricci
Dato:17/01/2014 08.44 (GMT+01:00)
Til: Göran Broström ,r-h...@stat.math.ethz.ch
Emne: Re: [R] Estimating parameters of 3 parameters lognormal distribution

Hi Goran,

thanks for your suggestion, but I believe it's not helpful for me...

phreg statement "Proportional hazards model with parametric baseline hazard(s). 
 Allows for stratification with dif-ferent scale and shape in each stratum, and 
left truncated and right censored data"

I've data whose distribution is lognormal with three parameters, I need to fit 
this model and its 3 parameters, especially the the 3rd, the theresold.
Regards.
VR



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



Il Venerdì 17 Gennaio 2014 8:26, Vito Ricci  ha scritto:

Many thanks for your suggestion.
>Regards.
>VR
>
>
>
>
>Se non ora, quando?
>Se non qui, dove?
>Se non tu, chi?
>
>
>
>Il Giovedì 16 Gennaio 2014 22:31, Göran Broström  ha 
>scritto:
>
>On 01/16/2014 04:59 PM, Vito Ricci wrote:
>>> Hi guys,
>>>
>>> is there in some R package a statement to fit parameters in a 3 parameters 
>>> lognormal distribution.
>>
>>Yes, the function 'phreg' in the package 'eha'.
>>
>>Göran Broström
>>
>>
>>
>>> Many thanks
>>> Vito Ricci
>>> [[alternative HTML version deleted]]
>>>
>>> __
>>> 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.
>>
>>>
>>
>>
>>
>
>
[[alternative HTML version deleted]]


[[alternative HTML version deleted]]

__
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.


Re: [R] Estimating parameters of 3 parameters lognormal distribution

2014-01-17 Thread Göran Broström



On 01/17/2014 08:42 AM, Vito Ricci wrote:

Hi Goran,

thanks for your suggestion, but I believe it's not helpful for me...

phreg statement "Proportional hazards model with parametric baseline
hazard(s). Allows for stratification with dif-ferent scale and shape in
each stratum, and left truncated and right censored data"

I've data whose distribution is lognormal with three parameters, I need
to fit this model and its 3 parameters, especially the the 3rd, the
theresold.


Right; the "third parameter" in the extension of the lognormal (and 
loglogistic) distribution in phreg is a 'proportional hazards' 
parameter, i.e., multiplying the standard lognormal (loglogistic) hazard 
function by a constant. If you want a threshold parameter, it is not for 
you.


Göran



Regards.
VR

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


Il Venerdì 17 Gennaio 2014 8:26, Vito Ricci  ha
scritto:

Many thanks for your suggestion.
Regards.
VR

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


Il Giovedì 16 Gennaio 2014 22:31, Göran Broström
 ha scritto:

On 01/16/2014 04:59 PM, Vito Ricci wrote:
 > Hi guys,
 >
 > is there in some R package a statement to fit parameters in a
3 parameters lognormal distribution.

Yes, the function 'phreg' in the package 'eha'.

Göran Broström



 > Many thanks
 > Vito Ricci

 > [[alternative HTML version deleted]]
 >
 > __
 > 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.

 >






__
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.


Re: [R] Estimating parameters of 3 parameters lognormal distribution

2014-01-16 Thread Vito Ricci
Hi Goran,

thanks for your suggestion, but I believe it's not helpful for me...

phreg statement "Proportional hazards model with parametric baseline hazard(s). 
 Allows for stratification with dif-ferent scale and shape in each stratum, and 
left truncated and right censored data"

I've data whose distribution is lognormal with three parameters, I need to fit 
this model and its 3 parameters, especially the the 3rd, the theresold.
Regards.
VR


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



Il Venerdì 17 Gennaio 2014 8:26, Vito Ricci  ha scritto:
 
Many thanks for your suggestion.
>Regards.
>VR
>
>
>
> 
>Se non ora, quando?
>Se non qui, dove?
>Se non tu, chi?
>
>
>
>Il Giovedì 16 Gennaio 2014 22:31, Göran Broström  ha 
>scritto:
> 
>On 01/16/2014 04:59 PM, Vito Ricci wrote:
>>> Hi guys,
>>>
>>> is there in some R package a statement to fit parameters in a 3 parameters 
>>> lognormal distribution.
>>
>>Yes, the function 'phreg' in the package 'eha'.
>>
>>Göran Broström
>>
>>
>>
>>> Many thanks
>>> Vito Ricci
>>>     [[alternative HTML version deleted]]
>>>
>>> __
>>> 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.
>>
>>>
>>
>>
>>
>
>
[[alternative HTML version deleted]]

__
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.


Re: [R] Estimating parameters of 3 parameters lognormal distribution

2014-01-16 Thread Göran Broström

On 01/16/2014 04:59 PM, Vito Ricci wrote:

Hi guys,

is there in some R package a statement to fit parameters in a 3 parameters 
lognormal distribution.


Yes, the function 'phreg' in the package 'eha'.

Göran Broström



Many thanks
Vito Ricci
[[alternative HTML version deleted]]

__
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.



__
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.


[R] Estimating parameters of 3 parameters lognormal distribution

2014-01-16 Thread Vito Ricci
Hi guys,

is there in some R package a statement to fit parameters in a 3 parameters 
lognormal distribution.
Many thanks
Vito Ricci
[[alternative HTML version deleted]]

__
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.