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 On Tue, Jul 3, 2012 at 1:30 PM, Bert Gunter <bgun...@gene.com> wrote: > 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 imho > > 5. A matrix is not a data frame. If you do not understand the difference > between these 2 structures and do not wish to spend the time to learn, > please stop using R. > > 6. You cannot "reparametrize in terms of 1's 0's and -1's." b has 4 > levels. > > Cheers, > Bert > > On Tue, Jul 3, 2012 at 1: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? >> >> 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 >> 10 3 2 >> 11 3 3 >> 12 3 4 >> >> I am using the tree dataset in R. I want to form a reparameterized design >> matrix in ones, zeroes and minus ones. The dataframe dd is very important >> here. >> >> Can anyone assist here? Thanks in advance. >> >> Mary A. Marion >> >> >> >> >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > > > -- > > Bert Gunter > Genentech Nonclinical Biostatistics > > Internal Contact Info: > Phone: 467-7374 > Website: > > http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm > > > -- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.