Re: [R] Application of rolling window in entropy analysis

2018-11-02 Thread Eric Berger
You have not provided any information that leads you to write 'it is not working'. Can you be specific? Are you getting error messages? What are they? etc etc On Fri, Nov 2, 2018 at 12:33 PM Subhamitra Patra wrote: > ts= India[-1,] > N<-ncol(ts) > width <- 500 > M <- nrow(ts) - width > r<-matri

Re: [R] Application of rolling window in entropy analysis

2018-11-02 Thread Subhamitra Patra
ts= India[-1,] N<-ncol(ts) width <- 500 M <- nrow(ts) - width r<-matrix(0, ncol = N, nrow = M) library(pracma) for (i in 1:N){ r[,i]<-rollapply( data=ts[,i], width=width, FUN=approx_entropy, edim = 2, r = 0.2*sd(ts[,i]), elag = 1, align="right") } This is my entropy value which I am interes

Re: [R] Application of rolling window in entropy analysis

2018-11-02 Thread Eric Berger
How about something like this: ts= India[-1,] #For deleting the year row N<-ncol(ts) width <- 500 M <- nrow(ts) - width r<-matrix(0, ncol = N, nrow = M) library(pracma) for (i in 1:N){ r[,i]<-rollapply( data=ts[,i], width=width, FUN=approx_entropy, edim = 2, r = 0.2*sd(ts[,i]), elag =

Re: [R] Application of rolling window in entropy analysis

2018-11-02 Thread Subhamitra Patra
Thank you for the clarification. I checked and there was a small mistakes in the code. Now my code is ts= India[-1,] #For deleting the year row N<-ncol(ts) r<-matrix(0, ncol = N, nrow = 1) library(pracma) for (i in 1:N){ r[i]<-approx_entropy(ts[,i], edim = 2, r = 0.2*sd(ts[,i]), elag

Re: [R] Application of rolling window in entropy analysis

2018-11-02 Thread Eric Berger
Hi, You have some problems with your setup. You set N based on the number of rows in ts, but then in the call to approx_entropy you write ts[,i]. Note that ts[,i] is the i'th column of ts, whereas your definition of i implies it is based on row numbers. Maybe this is leading you to see problems el

[R] Application of rolling window in entropy analysis

2018-11-02 Thread Subhamitra Patra
Dear all R users, I want to apply the entropy methods in rolling window analysis. I tried with the rollapply function, but it is not working. For your convenience, I am providing my code so that you can easily suggest me the application of rolling window in the particular methodology. Here is my c