先日読んだ論文で使われていたDFAを試してみようとRのpackageをインストール。

install.packages("fractal", dependencies = TRUE)
library(fractal)

#正規乱数で試して見る
x <- DFA(rnorm(1024))
print(x)
eda.plot(x)

#正規乱数で試して見る,時間窓は1.1倍刻みで,途中の経過を表示
x <- DFA(rnorm(1024),scale.ratio=1.1,verbose=TRUE)
print(x)
eda.plot(x)

#結果のwindow sizeとresidualを取り出す。
attributes(x)
y <- paste(attr(x,"scale"),attr(x,"stat"),sep=",")
write.table(y,"test.csv",append=FALSE,quote=FALSE,row.names=FALSE,col.names=FALSE)

#結果のH指数を取り出す
z <- attr(x,"logfit")
write.table(z$coefficients[2],"test.csv",append=FALSE,quote=FALSE,row.names=FALSE,col.names=FALSE)

#window内を2次式で近似
z <- DFA(rnorm(1024),detrend="poly2",scale.ratio=1.1)
eda.plot(z)

「scale.ratio: the ratio of successive scales. This argument is used as an input to the logScale function. Default: 2.」なので,
scale.ratio=2だと,Scale 6.00000 12.00000 24.00000 48.000 96.0000 192.0000 384.00。
scale.ratio=1.1だと,Scale 6.0000 7.00000 8.0000 9.00000 10.00000 11.0000 12.000 14.0000 15.0000 17.00000 18.00000 20.00000 22.00000 25.00000 27.00000 30.00000 .... てな具合。