similar to: Generating unique permutations of a vector

Displaying 20 results from an estimated 20000 matches similar to: "Generating unique permutations of a vector"

2011 Aug 10
2
choosing selective data with permutations
Hello, I am a R beginner and hoping to obtain some hints or suggestions about using permutations to sort a data set I have. Here is an example dataset: Ind1 11 00 12 15 28 Ind2 21 33 22 67 52 Ind3 22 45 21 22 56 Ind4 11 25 74 77 42 Ind5 41 32 67 45 22 This will be read into a variable using read.table. What I want to do is permute these individuals and every
2007 Oct 02
1
permutations of a binary matrix with fixed margins
J?r?me, As a first attempt, how about the function below. It works (or not) by randomly sorting the rows and columns, then searching the table for "squares" with the corners = matrix(c(1,0,0,1),ncol=2) and subtracting them from 1 to give matrix(c(0,1,1,0),ncol=2) (and vice versa). Randomized matrices can be produced as a chain where each permutation is seeded with the previous one.
2009 Oct 10
1
permutations
Question 1. I would calculate all the permutations of numbers (23,46,70,71,89) How can I write correctly the code? (Load gregmisc) > permutations (..?...) ______________________ Question 2. It's possible permute a string? ..for example: EIGER EGIER EREGI etc..etc.. Thanks, E. -- View this message in context: http://www.nabble.com/permutations-tp25834463p25834463.html Sent from the R
2017 Dec 08
2
Curiously short cycles in iterated permutations with the same seed
I have noticed that when I iterate permutations of short vectors with the same seed, the cycle lengths are much shorter than I would expect by chance. For example: X <- 1:10 Xorig <- X start <- 112358 N <- 10 for (i in 1:N) { seed <- start + i for (j in 1:1000) { # Maximum cycle length to consider set.seed(seed) # Re-seed RNG to same initial state X <- sample(X)
2002 Jan 16
2
exhaustive permutations
Hello R-help Readers I'm currently in the process of trying to write a permutation test procedure for looking at differences between groups with a multivariate data set (something equivalent to ANOSIM - analaysis of similarities for those familiar with this test). As with other permutation tests, for cases where there are large numbers of possible permutations, randomly sampling from these
2017 Dec 08
0
Curiously short cycles in iterated permutations with the same seed
Hi Boris, Do a search on "the order of elements of the symmetric group". (This search will also turn up homework questions and solutions.) You will understand why you are seeing this once you understand how a permutation is decomposed into cycles and how the order relates to a partition of n (n=10 in your case). Enjoy! Eric On Fri, Dec 8, 2017 at 6:39 AM, Boris Steipe <boris.steipe
2018 May 23
3
find the permutation function of a sorting
Thanks, David. I got the answer from the web. Is there any easy way to permute a set (e.g., a set of characters) by the permutation it returns? Thanks, > x <- c(10,7,4,3,8,2) > sort(x, index.return=TRUE) $x [1] 2 3 4 7 8 10 $ix [1] 6 4 3 2 5 1 2018-05-23 10:49 GMT+08:00 David Winsemius <dwinsemius at comcast.net>: > > > > On May 22, 2018, at 10:06 PM, John
2018 May 23
0
find the permutation function of a sorting
> On May 22, 2018, at 10:57 PM, John <miaojpm at gmail.com> wrote: > > Thanks, David. > I got the answer from the web. > Is there any easy way to permute a set (e.g., a set of characters) by the permutation it returns? Thanks, > > > > x <- c(10,7,4,3,8,2) > > sort(x, index.return=TRUE) > $x > [1] 2 3 4 7 8 10 > > $ix > [1] 6 4 3 2
2010 Jan 28
2
Constrained vector permutation
Hello, I'm trying to permute a vector of positive integers > 0 with the constraint that each element must be <= twice the element before it (i.e. for some vector x, x[i] <= 2*x[i-1]), assuming the "0th" element is 1. Hence the first element of the vector must always be 1 or 2 (by assuming the "0th" element is 1). Similarly, the 2nd must always be below/= 4, the
2008 Jan 25
1
increasing speed for permutations of glm
Dear R Programmers, I am trying to run a Poisson regression on all pairs of variables in a data set and obtain the permutation distribution. The number of pairs is around 100000. It seems my code will take weeks to run, unless I try something else. Could you give me any suggestions on how to improve the speed of the code below, or any general suggestions on how I may accomplish this task. Thanks
2010 Jan 19
1
restricted permutations in permtest()?
Hallo List, I'm trying to implemement a restricted permutation scheme in permutest(). More precisely I have dependence in my data that should be allowed for in the permutation - I simulated the problem in the example of the vegan documentation p.24: library(vegan) data(varespec) ## Bray-Curtis distances between samples dis <- vegdist(varespec) ## First 16 sites grazed, remaining 8 sites
2010 Apr 19
1
What is mclust up to? Different clusters found if x and y interchanged
Hello All... I gave a task to my students that involved using mclust to look for clusters in some bivariate data of isotopes vs various mining locations. They discovered something I didn?t expect; the data (called tur) is appended below. p <- qplot(x = dD, y = dCu65, data = tur, color = mine) print(p) # simple bivariate plot of the data; looks fine mod1 <- Mclust(tur[,2:3]) mod1$G mod2
2018 May 23
2
find the permutation function of a sorting
Hi, Is there any way to find the permutation function of the sorting and to apply the function (or its inverse) elsewhere? For example, the following permutation function from the sorting in the matrix form is c(1,2,3), c(2,1,3) > sort(c("bc","ac","dd")) [1] "ac" "bc" "dd" I try to find it in the permutations/permute
2004 Jul 13
3
(no subject)
Dear R users, First of all, thanks for the incredibly fast answers and help of Rolf, Marc and Robert. Yes, I noticed that it was a lot of permutacions, but my intention was to make this process automatic and take only 5.000 - 10.000 permutations. Therefore, I wanted only to take that "interesting permutations" with "some information" [inter-block permutations]. The
2018 May 23
3
find the permutation function of a sorting
> sort(c("bc","ac","dd"), index.return=TRUE) $x [1] "ac" "bc" "dd" $ix [1] 2 1 3 We have the permutation, namely 1-->2, 2-->1, 3-->3. How can I apply the permutation function to a new set c("D","E", "F")? so that the result is c("E","D", "F"). 2018-05-23 11:06
2012 Feb 18
2
transforming a data frame to matrix
Hello > orderulcount Group.1 Group.2 Group.3 x V5 7 C L 0.0 30 C / L 19 C L 0.2 27 C / L 31 C L 0.4 15 C / L 43 C L 0.6 7 C / L 54 C L 0.8 2 C / L 10 C S 0.0 27 C / S 22 C S 0.2 10 C / S 34 C S 0.4 6 C / S 46 C S 0.6 1 C / S 1 D
2009 Nov 15
1
how to permute, simulate Markov chain
Hi all, I am new to R. Can someone please give me some hints in how to do the following things: 1- Get ONE permutation of a set. I have looked at the gregmisc package's permutations() method, but I just want to get one permutation at a time. 2- Simulate a Markov chain in R. For instance, I want to simulate the simple random walk problem, in which a person can walk randomly around 4 places.
2006 May 03
1
Permutation test of marked point pattern
Dear R users, I am trying to perform a hypothesis test on a marked point pattern. I would like to calculate the mean of the absolute value of the difference of marks between nearest neigbours, randomize the marks among points, then calculate this mean again. Ideally, I would test whether random mean values smaller than the observed mean value occur less than 5% of the time. I suppose 1000
2008 Mar 31
1
solver in R
Dear R-users, Is there any function in R that works similarly like solver in Excel. I have a set of daily rainfall data and I would like to estimate alpha and beta for the gamma function. Here is my daily rainfall data: [1] 0.2 1.2 0.0 0.0 0.0 0.0 0.0 0.6 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 4.8 1.6 0.0 1.8 1.8 0.0 2.6 [24] 33.0 19.0 0.0 0.0 0.6 0.0 0.0 6.8 0.2 0.0
2011 Feb 10
3
Permuting rows of a matrix
Hi, I need to permute the rows of a matrix, where each row is independently rearranged. A simple solution is this: shuffled <- datamatrix <- matrix(1:24, ncol = 4) for (i in 1:nrow(datamatrix)) { shuffled[i, ] <- sample(datamatrix[i, ]) } > datamatrix [,1] [,2] [,3] [,4] [1,] 1 7 13 19 [2,] 2 8 14 20 [3,] 3 9 15 21 [4,] 4 10 16 22 [5,]