[R] cox model

2018-11-02 Thread post .
I need a R-code for a situation that is well described in the sas help. I would be very grateful for the help! "Time-dependent variables can be used to model the effects of subjects transferring from one treatment group to another. One example of the need for such strategies is the Stanford heart t

[R] cox model

2018-11-02 Thread post .
I need a R-code for a situation that is well described in the sas help. I would be very grateful for the help! "Time-dependent variables can be used to model the effects of subjects transferring from one treatment group to another. One example of the need for such strategies is the Stanford heart t

Re: [R] Exact Poly-K Test

2018-11-02 Thread Bert Gunter
Oh, and if you wish to fake a famous name for your signature, you should get it right: it's Évariste Galois. Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Fri

Re: [R] Exact Poly-K Test

2018-11-02 Thread Bert Gunter
A search on rseek.org on "exact poly-k test" brought up several hits. Did you not try this? Are none of the hits suitable? Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic st

[R] Exact Poly-K Test

2018-11-02 Thread Evarite Galois
Hello All, I am looking for a package with an R implementation of the Exact Poly-K Test; any feedback will be greatly appreciated. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https:/

Re: [R] Remove specific rows from nested list of matrices

2018-11-02 Thread MacQueen, Don via R-help
It appears that at the bottom of the nesting, so to speak, you have a character matrix. That is, the contents of the [[1]][[1]][[1]] element is a character matrix that, according to the row and column labels, has 4 rows and 5 columns. However, the matrix itself, as printed, has, apparently, 4 col

Re: [R] Remove specific rows from nested list of matrices

2018-11-02 Thread William Dunlap via R-help
Since you cannot show the data you have have to learn some R debugging techniques. Here is some data that look something like yours and I want to delete rows of character matrices whose first entry starts with a space. FF <- lapply(1:2,function(i)lapply(1:3, function(j) lapply(1:2, function(k)

Re: [R] Remove specific rows from nested list of matrices

2018-11-02 Thread Jeff Newmiller
A partial dput is no help at all. A complete dput of part of your data is much more likely to be helpful, but only if you see the same problem in it as you do in the full data set. As to private data... if you want data handling help in a public forum then you need to create a small set of data

Re: [R] Remove specific rows from nested list of matrices

2018-11-02 Thread Ek Esawi
Thank you Jeff and Bert. I know i have to use dput add provide a reproducible example. The problem is that the output,is huge, has many nested lists, and the info is private. Here is the first line of dput(FF) if it helps: dput(FF) list(list(list(structure(c("12/30 12/30", "01/02 01/02", "01/02 0

Re: [R] Remove specific rows from nested list of matrices

2018-11-02 Thread Jeff Newmiller
Can you supply the output of dput(FF) ? On November 2, 2018 8:00:08 AM PDT, Ek Esawi wrote: >Hi All, > >I have a list that is made up of nested lists, as shown below. I want >to remove all rows in each sub-list that start with an empty space, >that’s the first entry of a row is blank; for examp

Re: [R] Remove specific rows from nested list of matrices

2018-11-02 Thread Bert Gunter
If you learn to use dput() to provide useful examples in your posts, you are more likely to receive useful help. It is rather difficult to make much sense of your messy text, though some brave soul(s) may try to help. Bert Gunter "The trouble with having an open mind is that people keep coming al

[R] Remove specific rows from nested list of matrices

2018-11-02 Thread Ek Esawi
Hi All, I have a list that is made up of nested lists, as shown below. I want to remove all rows in each sub-list that start with an empty space, that’s the first entry of a row is blank; for example, on [[1]][[1]][[1]] Remove row 4,on [[1]][[1]][[3]] remove row 5, on [[1]][[2]][[1]] remove row 6,

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

[R] Granger causality: lag selection

2018-11-02 Thread John
Hi, I see an R user chooses the lag of Granger causality by finding out the lag for the most significant result https://www.r-bloggers.com/granger-causality-test/ Is it generally legitimate to do so, without determining the lag first by AIC or BIC? Thanks, John [[alternativ