I’m working with the fractal package and using the DFA function which gives me a very complete output in the console :
DFA(log(price_1m[1:1024]),detrend="poly2",overlap=0,scale.max=512)
Console output :
Detrended fluctuation analysis for log(price_1m[1:1024])
--------------------------------------------------------
H estimate : 0.452347
Domain : Time
Statistic : RMSE
Length of series : 1024
Block detrending model : x ~ 1 + t + I(t^2)
Block overlap fraction : 0
Scale ratio : 2
Scale 6.00000000 1.2000e+01 2.4000e+01 4.8000e+01 96.0000000 1.920e+02 3.8400e+02
RMSE 0.00029362 4.2002e-04 5.2302e-04 8.5258e-04 0.0011629 1.403e-03 1.7068e-03
Message d'avis :
In if (cls == "signalSeries") { :
la condition a une longueur > 1 et seul le premier élément est utilisé
the fact is thah I only want and need the Hurst exponent estimate. So I would like to get rid of all the rest.
So I’ve tried to get the attributes of the DFA function (the DFA function give a fractalBlock object) and here is what I get in the console :
Call:
lm(formula = y ~ 1 + x, data = data.frame(x = xx, y = yy, w = ww),
weights = w)
Coefficients:
(Intercept) x
-8.9269 0.4523
Message d'avis :
In if (cls == "signalSeries") { :
la condition a une longueur > 1 et seul le premier élément est utilisé
Ok, I’ve got a lm object from which I can extract the slope parameter estimate with :
attr(DFA(log(price_1m[1:1024]),detrend="poly2",overlap=0,scale.max=512),which="logfit")$coef[2]
and here is what it’s printed in the console :
x
0.452347
Message d'avis :
In if (cls == "signalSeries") { :
la condition a une longueur > 1 et seul le premier élément est utilisé
and here is the point : I only want to get the numeric value that is 0.452347. I’ve tried to convert my data using the as.numeric() function but it does not work.
Thanks for your help.
This would give you an unnamed Double as a result:
But would maybe still include the warning. What if you first assign to a variable and then print?
If you still receive this warning you can perhaps suppress it with
try: