search for: ncomb

Displaying 2 results from an estimated 2 matches for "ncomb".

Did you mean: comb
2005 Nov 23
2
vector of permutated products
...vector of permutated products (1-x1)*(1-x2)*(1-x3) (1-x1)*(1-x2)*x3 (1-x1)*x2*(1-x3) x1*(1-x2)*(1-x3) (1-x1)*x2*x3 x1*(1-x2)*x3 x1*x2*(1-x3) x1*x2*x3 Now, I already have the correctly sorted matrix of permutations! So, the input looks something like: #input x<-c(0.3,0.1,0.2) Nx<-length(x) Ncomb<-2^Nx permat<-matrix(c(1,1,1,1,1,0,1,0,1,1,0,0,0,1,1,0,1,0,0,0,1,0,0,0),Ncomb,Nx) I code the rest as follows: #correct but clumsy code temp1<-t(matrix(rep(x,2^3),3,2^3)) temp2<-t(matrix(rep(1-x,2^3),3,2^3)) result<-apply(permat*temp1-(permat-1)*temp2,1,prod) But I would like to do...
2007 Nov 19
4
sequence of vectors
Dear All, I wonder if there is any R function to generate a sequence of vectors from existing ones. For example: x 1<- c(1,2,3) x2 <- c(4,5) x3 <- c(6,7,8) The desired output is a list of all 3*2*3 = 18 possible combinations of elements of x1,x2 and x3. One element for example is (1,4,6). Many thanks in advance, Bernard