Re: [R] create matrices with constraint

2014-12-15 Thread John McKown
On Mon, Dec 15, 2014 at 10:06 AM, David L Carlson wrote: > Actually there are not so many matrices as you suggest. > > > comb <- combn(28, 4) > > dim(comb) > [1] 4 20475 > > sum(comb[1,]==1) > [1] 2925 > > comb[, 1] > [1] 1 2 3 4 > > There are 20,475 combinations, but you cannot choose any fo

Re: [R] create matrices with constraint

2014-12-15 Thread David L Carlson
ohn McKown Sent: Monday, December 15, 2014 9:23 AM To: Kathryn Lord Cc: r-help Subject: Re: [R] create matrices with constraint On Fri, Dec 12, 2014 at 11:00 AM, Kathryn Lord wrote: > Dear all, > > Suppose that I have natural numbers 1 through 28. > > Based on these numbers, choose 4

Re: [R] create matrices with constraint

2014-12-15 Thread John McKown
On Fri, Dec 12, 2014 at 11:00 AM, Kathryn Lord wrote: > Dear all, > > Suppose that I have natural numbers 1 through 28. > > Based on these numbers, choose 4 numbers 7 times without replacement and > make a 4 by 7 matrix, for example, > > ​After a relaxing weekend, it came to me that these 4x7 mat

Re: [R] create matrices with constraint

2014-12-14 Thread John McKown
On Sun, Dec 14, 2014 at 9:30 AM, Gerrit Draisma wrote: > Ha John, > Sorry I did not follow the discussion but what > about > combn(1:28,4) > ? > Gerrit. ​Very nice! Thanks. The form needed by the OP would be t(combn(1:28,4)) to swap rows & columns. I'm cross posting this to the r-help so tha

Re: [R] create matrices with constraint

2014-12-13 Thread John McKown
On Fri, Dec 12, 2014 at 1:45 PM, John McKown wrote: > ​ > ​​ > Hum. Consider the set of all possible unique 4 value vectors in which the > values in the vectors are taken, without replacement, from the numbers 1 > through 28. This is a mathematical concept called "combination". In this > case,

Re: [R] create matrices with constraint

2014-12-12 Thread Richard M. Heiberger
I think you might be looking for incomplete block designs. See Cochran and Cox 1957, page 481 for Plan 11.38 t=28, k=4, r=9, b=63, lambda=1, E=.78. Type I This design might be the set of 4 x 7 matrices you are looking for. On Fri, Dec 12, 2014 at 12:00 PM, Kathryn Lord wrote: > Dear all, > > Su

Re: [R] create matrices with constraint

2014-12-12 Thread John McKown
On Fri, Dec 12, 2014 at 12:17 PM, peter dalgaard wrote: > > > On 12 Dec 2014, at 18:00 , Kathryn Lord > wrote: > > > > Dear all, > > > > Suppose that I have natural numbers 1 through 28. > > > > Based on these numbers, choose 4 numbers 7 times without replacement and > > make a 4 by 7 matrix, fo

Re: [R] create matrices with constraint

2014-12-12 Thread peter dalgaard
> On 12 Dec 2014, at 18:00 , Kathryn Lord wrote: > > Dear all, > > Suppose that I have natural numbers 1 through 28. > > Based on these numbers, choose 4 numbers 7 times without replacement and > make a 4 by 7 matrix, for example, > >> a1 > [,1] [,2] [,3] [,4] [,5] [,6] [,7] > [1,]1

[R] create matrices with constraint

2014-12-12 Thread Kathryn Lord
Dear all, Suppose that I have natural numbers 1 through 28. Based on these numbers, choose 4 numbers 7 times without replacement and make a 4 by 7 matrix, for example, > a1 [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,]159 13 17 21 25 [2,]26 10 14 18 22 26 [3,