Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201894

Wrong results due to NaN (package InfoTrad)

$
0
0

I'm trying to use a package called InfoTrad. I tried to compute an example given, but it doesn't produce the same results for me. Could the computing capacity be a reason for this? I get a bunch of NaNs, which are probably the reason for the wrong results. The code is as follows:

library(InfoTrad)
Buy <- c(350,250,500,552,163,345,847,923,123,349)
Sell <- c(382,500,463,550,200,323,456,342,578,455)
data = cbind(Buy,Sell)
#par0 = (al,del,mu,eps_b,eps_s)
par0 = c(0.5, 0.5, 300, 400, 500)

EHO_out = EHO(data)
model = optim(par0, EHO_out, gr = NULL, method = c("Nelder-Mead") , hessian = FALSE)
print(model)

#output
$par
[1] -216494.389  631863.422     380.386     307.447     435.555

$value
[1] -44532.65

The real result (from the example) should look like this:

$par
[1] 0.9111102  0.0001231429     417.1497     336.075     466.2539

Here's the link to the paper, where they explain the package: https://www.semanticscholar.org/paper/InfoTrad%3A-An-R-package-for-estimating-the-of-%C3%87elik-Tini%C3%A7/9efb3f9de4781bed286e16e9f4e2a87653bea693

Is there any way to change the limit values, so that I do not produce any NaNs or at least less? Thank you in advance. I'd appreciate it, if you could run the code once and tell me, if your results differ from mine. (I just want to know, if it's my computer's fault)


Viewing all articles
Browse latest Browse all 201894

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>