Displaying 1 result from an estimated 1 matches for "permat".
Did you mean:
perma
2005 Nov 23
2
vector of permutated products
...tated 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 without temp1 a...