[R] design matrix creation in R

2012-07-03 Thread mmstat
Hello, I want to create a design matrix using R. Can you explain the code which creates the following please? I understand the first part. b=g1(?) does what? dd - data.frame(a = gl(3,4), b = gl(4,1,12)) # balanced 2-way dd a b 1 1 1 2 1 2 3 1 3 4 1 4 5 2 1 6 2 2 7 2 3 8 2 4 9 3 1

Re: [R] design matrix creation in R

2012-07-03 Thread Bert Gunter
1. You need to learn to use R Help. It is there for a purpose. help (help) ## or ?help is where to start. 2. Before posting further, please read An Introduction to R. Ships with every distro. 3. ?gl 4. This is not the best way to do this anyway. dd - expand.grid(b=1:4,a=1:3) ## is preferable

Re: [R] design matrix creation in R

2012-07-03 Thread David Winsemius
On Jul 3, 2012, at 4:10 PM, mms...@comcast.net wrote: Hello, I want to create a design matrix using R. Can you explain the code which creates the following please? I understand the first part. What first part if the next part is ... this ? b=g1(?) does what? That's just generating a

Re: [R] design matrix creation in R

2012-07-03 Thread Duncan Murdoch
On 03/07/2012 4:10 PM, mms...@comcast.net wrote: Hello, I want to create a design matrix using R. Can you explain the code which creates the following please? I understand the first part. b=g1(?) does what? That is gl, not g1 (i.e. gee ell not gee one).See ?gl for a description.

Re: [R] design matrix creation in R

2012-07-03 Thread Bert Gunter
If David's response is what you were seeking, I would then ask: homework?? In general, explicit model matrices are not needed for linear modeling in R. Still not clear what you meant by reparametrization, but if David's interpretation is correct, my impossible comment is clearly wrong. -- Bert