[R] elimination duplicate elements sampling!

elephann elephann at gmail.com
Fri Jul 8 00:23:52 CEST 2011


Hi everyone!
I have a data frame with 1112 time series and I am going to randomly
sampling r samples for z times to compose different portfolio size(r
securities portfolio). As for r=2 and z=10000,that's:
z=10000
A=seq(1:1112)
x1=sample(A,z,replace =TRUE)
x2=sample(A,z,replace =TRUE)
M=cbind(x1,x2) # combination of 2 series
Because in a portfolio with x1[i]=x2[i],(i=1,2,...,10000) means a 1
securities' portfolio,not 2 securities',it should be eliminated and
resampling. With r increase, for example r=k, how do I efficiently
eliminated all such portfolio as x1[i]=x2[i]=...=xk[i]?

Besides, any r securities' portfolio with the same securities' combination
means the same portfolio(given same weights as here), e.g.
M(x1[i],x5[i],x7[i],x1000[i]) and M(x5[i],x7[i],x1[i],x1000[i]) or
M(x1[i],x7[i],x5[i],x1000[i]) are the same, how do I efficiently eliminat
these possibilities?

--
View this message in context: http://r.789695.n4.nabble.com/elimination-duplicate-elements-sampling-tp3652791p3652791.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list