[FLR-list] Hockey stick

Iago Mosqueira iago.mosqueira-sanchez at jrc.ec.europa.eu
Tue Mar 20 23:10:38 CET 2012


On 03/21/2012 02:45 AM, Luis Ridao wrote:
> FLR-help,
>
> I'm fitting a Hockey-stick function with following:
>
> fsai.segreg <- fsaiSR
> model(fsai.segreg) <- segreg()
> fsai.segreg <- fmle(fsai.segreg)
>
> and the parameter estimates are as follows:
>
>  > params(fsai.segreg)
> An object of class "FLPar"
> params
>         a        b
>   0.63387 45.31551
> units:  NA
>
> However I want to use the parameter estimates from ADMB
> which are something like :
>
> a = 0.6060456
> b = 56.51466
>
> How can i set the ADMB-estimates in the 'fsai.segreg' object and recalculate
> the residuals and log-likelihood based on these estimates?
>
> I do something like:
>  > model(fsai.segreg3) <- segreg(FLpar(a = exp(-0.5008), b = exp(4.0345)))
> Error in segreg(FLpar(a = exp(-0.5008), b = exp(4.0345))) :
>
> and :
>
>  > model(fsai.segreg3) <- segreg(params=list(FLpar(a = exp(-0.5008), b =
> exp(4.0345))))
> Error in segreg(params = list(FLpar(a = exp(-0.5008), b = exp(4.0345)))) :
>    unused argument(s) (params = list(FLpar(a = exp(-0.5008), b =
> exp(4.0345))))
>
>
> Thanks in advance

params(fasi.segreg3) <- FLPar(a = exp(-0.5008), b = exp(4.0345))

should get you the parameter values into the object. Then you will have 
to calculate the estimated values residuals and get them into the fitted 
and residuals slots. For the logLik, we simply report the value returned 
by optim.

Cheers,


Iago



More information about the flr-list mailing list