On Thu, 09 May 2013, Neuman Co <neumanc...@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 ______________________________________________ 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.