[R] Fit a standardized generalized hyperbolic distribution to my data?
Enrico Schumann
es at enricoschumann.net
Mon May 13 09:39:04 CEST 2013
On Thu, 09 May 2013, Neuman Co <neumancohu at gmail.com> writes:
> Hi,
> I want to fit a standardized generalized hyperbolic distribution to my
> data, I am using the dsgh command of the fBasics package and the optim
> command.
>
> I tried the following:
>
> ----------------------------------------------------------------------------------------------------------------------------
> startvalue<-c(1,0.5,1)
> loglikstandghyp <-function(zetapar,rhopar,lambdapar){
> if(par>0) return(-sum(log(dsgh(mydata,zeta=zetapar,rho=rhopar,lambda=lambdapar))))
> else return(Inf)
> }
>
> optim(startvalue, fn=loglikstandghyp, method="BFGS")
> -----------------------------------------------------------------------------------------------------------------------------
>
> the problem is, that I get the following error message (in german):
>
> Fehler in if (delta <= 0) stop("delta must be greater than zero") :
> Fehlender Wert, wo TRUE/FALSE nötig ist
>
> Now my question is, where is my mistake?
Please provide a reproducible example, as the posting guide asks you to.
But "Fehlender Wert, wo TRUE/FALSE nötig ist" means that "delta <= 0"
does not evaluate to TRUE or FALSE, but NA.
>
> Thanks a lot for your help!
>
>
> --
> Neumann, Conrad
>
--
Enrico Schumann
Lucerne, Switzerland
http://enricoschumann.net
More information about the R-help
mailing list