[R] how to get design matrix?

2009-05-10 Thread linakpl

How do you get the design matrix R used when calculating ANOVA?
-- 
View this message in context: 
http://www.nabble.com/how-to-get-design-matrix--tp23464638p23464638.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] how to get design matrix?

2009-05-10 Thread Gavin Simpson
On Sat, 2009-05-09 at 19:29 -0700, linakpl wrote:
 If I was doing an ANOVA analysis how can I get the design matrix R used?

You can do ANOVA several different ways in R, and that is just the few
functions to do this that I am aware of. Showing us what function/code
you used would be really helpful and is requested by the posting guide.

If you fitted the model using lm, then use the model.matrix method:

dat - data.frame(Y = rnorm(100), X = gl(4,25))
mod - lm(Y ~ X, data = dat)
mod
summary(mod)
model.matrix(mod)

This also works if you used aov()

If you used something else, then you'll have to say what...

HTH

G
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
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.


[R] how to get design matrix?

2009-05-09 Thread linakpl

If I was doing an ANOVA analysis how can I get the design matrix R used?
-- 
View this message in context: 
http://www.nabble.com/how-to-get-design-matrix--tp23466549p23466549.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] how to get design matrix?

2009-05-09 Thread David Winsemius


Got code?

On May 9, 2009, at 10:29 PM, linakpl wrote:



If I was doing an ANOVA analysis how can I get the design matrix R  
used?

--



David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
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.