Re: [R] doing 1000 permutations and doing test statistics distribution

2020-02-05 Thread Ivan Krylov
On Wed, 5 Feb 2020 09:15:16 -0600 Ana Marija wrote: > I tried to solve the task via following code: > all_results <- lapply(manyorders, function(ord) { # ... > list(fit = fit, y1 = y1) > }) > and I wrote all_results in a file > write.table(all_results, file="all_res", sep = " ", row.names =

Re: [R] doing 1000 permutations and doing test statistics distribution

2020-02-05 Thread Ana Marija
I tried to solve the task via following code: manyorders <- replicate(100, sample(colnames(dat)), simplify=FALSE) all_results <- lapply(manyorders, function(ord) { tmpdat <- `colnames<-`(dat, ord) # copies and renames in one line corfit <- duplicateCorrelation(dat, block = targets$Subject)

Re: [R] doing 1000 permutations and doing test statistics distribution

2020-02-04 Thread Bert Gunter
Yes, a clear thinko... Thanks for the correction. -- Bert On Tue, Feb 4, 2020 at 1:41 PM Duncan Murdoch wrote: > On 04/02/2020 4:28 p.m., Ana Marija wrote: > > I tired your code on this simplified data just for say 10 permutations: > > > > dat <- read.table(text = " code.1 code.2 code.3 code.

Re: [R] doing 1000 permutations and doing test statistics distribution

2020-02-04 Thread Duncan Murdoch
On 04/02/2020 4:28 p.m., Ana Marija wrote: I tired your code on this simplified data just for say 10 permutations: dat <- read.table(text = " code.1 code.2 code.3 code.4 1 82 93 NA NA 2 15 85 93 NA 3 93 89 NA NA 4 81 NA NA NA",

Re: [R] doing 1000 permutations and doing test statistics distribution

2020-02-04 Thread Ana Marija
I tired your code on this simplified data just for say 10 permutations: dat <- read.table(text = " code.1 code.2 code.3 code.4 1 82 93 NA NA 2 15 85 93 NA 3 93 89 NA NA 4 81 NA NA NA", header = TRUE, stringsAsFacto

Re: [R] doing 1000 permutations and doing test statistics distribution

2020-02-04 Thread Bert Gunter
I am not going to do your programming for you. If the following doesn't suffice, maybe someone else will provide you something that will. m = your matrix code = your code that uses m your list of results <- lapply(seq_len(1000), FUN = function(m){ m <- m[, sample.int(132)] code } ) or use an

Re: [R] doing 1000 permutations and doing test statistics distribution

2020-02-04 Thread Ana Marija
Basically I would just reshuffle column names in each of 1000 permutations how to do that and perform everything I described in my initial email On Tue, 4 Feb 2020 at 14:46, Ana Marija wrote: > Hi Bert, > > thanks for getting back to me. I have to permute those 132 columns > 1000 times and perfo

Re: [R] doing 1000 permutations and doing test statistics distribution

2020-02-04 Thread Ana Marija
Hi Bert, thanks for getting back to me. I have to permute those 132 columns 1000 times and perform the code given in the previous email. Can you please show me how you would do that in the loop? This is also a huge data set ... Thanks Ana On Tue, Feb 4, 2020 at 2:34 PM Bert Gunter wrote: > > I

Re: [R] doing 1000 permutations and doing test statistics distribution

2020-02-04 Thread Bert Gunter
If you just want to permute columns of a matrix, ?sample > sample.int(10) [1] 9 2 10 8 4 6 3 1 5 7 and you can just use this as an index into the columns of your matrix, presumably within a loop of some sort. If I have misunderstood, just ignore. Cheers, Bert On Tue, Feb 4, 2020 a

[R] doing 1000 permutations and doing test statistics distribution

2020-02-04 Thread Ana Marija
Hello, I have a matrix > dim(dat) [1] 15568 132 It looks like this: NoD_14381_norm.1 NoD_14381_norm.2 NoD_14381_norm.3 NoD_14520_30mM.1 NoD_14520_30mM.2 NoD_14520_30mM.3 Ku8QhfS0n_hIOABXuE 4.75 4.25 4.79 4.33 4.63