Displaying 1 result from an estimated 1 matches for "bestunits".
2008 Aug 22
1
Retrieving sample points
...sible samples (n combination (p+1)). I have written a syntax with worked well, but the problem is that it does not work when the dimension of X is large (when n is greater than 25). I think the problem is memory size, is there anyway I can maximize the memory.
Here is the syntax that I used.
> bestunits <- function(x){
+ n <- nrow(x)
+ p <- ncol(x)
+ h <- p+1
+ nchoosek <- function(n,h){
+ factorial(n)/(factorial(h+1)*factorial(n-h-1))}
+ vec11 <- matrix(nrow=nchoosek(n,h), ncol=p)
+ vec12 <- matrix(nrow=nchoosek(n,h), ncol=h)
+ for (i in 1:nchoosek(n,h)){
+ flag <- sample(...