Questions tagged [permute]

permute is an R package for generating restricted permutations. Its original intention was for use with the vegan package to analyse multivariate models for ecological data.

permute is an R package that generates permutations from restricted designs, such as permutations within blocks. permute allows the following designs

  • Randomisation (free permutation)
  • Cyclic shifts for line transects and time series
  • Toroidal shifts for spatial grids

These can be nested hierarchically with samples present at 3 levels:

  • Block: these are never permuted, only samples within blocks are permuted.
  • Plot: Plots lie within Blocks. Plots may further restrict permutation (i.e. the plots are not permuted) or they may be permuted using any of the above 3 permutation types.
  • Within-plot: these are the samples at the lowest level, the individual rows of the data. These may be held fixed (within any Plots and/or Blocks) or be permuted following one of the three methods above)

This hierarchy allows for the testing of complex designs, including split-plot experimental designs.

68 questions
46
votes
3 answers

How do I swap tensor's axes in TensorFlow?

I have a tensor of shape (30, 116, 10), and I want to swap the first two dimensions, so that I have a tensor of shape (116, 30, 10) I saw that numpy as such a function implemented (np.swapaxes) and I searched for something similar in tensorflow but…
Alexis Rosuel
  • 563
  • 1
  • 5
  • 12
14
votes
2 answers

JULIA : How to permute randomly a vector in julia?

l have a vector of random numbers that l want to permute randomly using randperm() function as follows but it's not working. X=rand(100000) # a vector of 100000 random elements Y=randperm(X) # want to permute randomly the vector x the returned…
vincet
  • 917
  • 3
  • 13
  • 26
6
votes
2 answers

Python wordlist permutation

How can i make this script to permute maximum of 3 combination of words from a list? List.txt consists of 4 strings: pass 10 test word Instead of combining all from one to four words i.e output > pass10wordtest, 10testpassword,....etc I want the…
sfad
  • 61
  • 1
  • 2
4
votes
2 answers

Permutations of 3 elements within 6 positions

I'm looking to permute (or combine) c("a","b","c") within six positions under the condition to have always sequences with alternate elements, e.g abcbab. Permutations could easily get…
fina
  • 429
  • 4
  • 12
4
votes
1 answer

Reshape array of images into a column vector, sorted row by row for each image

Hello dear Matlab experts, I have an array of images, let's say a 2 by 3 grid of images (6 images). Each image has a resolution of 4 x 4 (for simplicity). Lets say the images are grayscale. I loaded the images into a 4D matrix with dimensions 2 x 3…
awaelchli
  • 796
  • 7
  • 23
3
votes
1 answer

How to reorder dimensions?

I am working on precipitation data. I need to rearrange dimensions in a NetCDF file. The dimensions in my file are in (time, lat, lon) order. I need them in (lat, lon, time) order. I tried the following: ncpdq -a lat,lon,time infile.nc outfile.nc …
Chane
  • 45
  • 7
3
votes
2 answers

Broadcasting in Python with permutations

I understand that transpose on an ndarray is intended to be the equivalent of matlab's permute function however I have a specific usecase that doesn't work simply. In matlab I have the following: C = @bsxfun(@times, permute(A,[4,2,5,1,3]),…
3
votes
2 answers

Permute/randomize rows within a column independently

I have a dataframe like so: > df1 a b c 1 0.5 0.3 0 2 0.2 0 0 3 0 0.6 0 4 0 0 0.4 I would like to permute the rows within each column with replacement 1000 times, however I would like to do this independently for each column (like a slot machine…
user3816990
  • 247
  • 1
  • 2
  • 10
3
votes
1 answer

Error using ' Transpose on ND array is not defined?

I am getting error for my below code: temp=reshape(img',irow*icol,1); Error message:Error using ' Transpose on ND array is not defined. What is solution for this. I think I have to use permute(A,order) command. But I dont know how to use…
prashanth
  • 137
  • 2
  • 11
3
votes
1 answer

Use of permute package to calculate all permutations in a blocked design

I want to calculate all permutations of a blocked design suitable for a Friedman test. Consider the following example: thedata <- data.frame( score = c(replicate(4,sample(1:3))), judge = rep(1:4,each=3), wine = rep.int(1:3,4) ) Four…
Joris Meys
  • 106,551
  • 31
  • 221
  • 263
2
votes
0 answers

Specifying restricted permutations in adonis2 in Vegan-package

Similar questions have been posed earlier, but I have failed to correctly understand how to apply this to my exmperimental design. Experimental design: 9 blocks with an unbalanced number och plots in each block. 35 plots with 3 samples per year and…
2
votes
2 answers

Permute labels in a dataframe but for pairs of observations

Not sure title is clear or not, but I want to shuffle a column in a dataframe, but not for every individual row, which is very simple to do using sample(), but for pairs of observations from the same sample. For instance, I have the following…
mrfz098
  • 37
  • 4
2
votes
1 answer

How to make tensordot operations after permutation

I have 2 tensors, A and B: A = torch.randn([32,128,64,12],dtype=torch.float64) B = torch.randn([64,12,64,12],dtype=torch.float64) C = torch.tensordot(A,B,([2,3],[0,1])) D = C.permute(0,2,1,3) # shape:[32,64,128,12] tensor D comes from the…
2
votes
1 answer

How to generate stratified permutations in R

I would like to generate different possible permutations with the same frequency as in the input vector. For example, I would like to generate the permutations using the vector x in the below example. library(gtools) x <-…
Prradep
  • 5,506
  • 5
  • 43
  • 84
2
votes
1 answer

Restricted permutation (permute) fails using shuffleSet and runs using shuffle

I'm doing PRC using the vegan-package but run into trouble when I attempt to perform an Anova on the results. I get the following error-message: Error in doShuffleSet(spln[[i]], nset = nset, control) : number of items to replace is not a multiple…
Nightingale
  • 233
  • 1
  • 10
1
2 3 4 5