[R] Storing data from a test as a vector or matrix

2011-05-04 Thread wwreith
I just finished a MANOVA test and got the following output:

 summary(M, test=Pillai)
Df Pillai approx F num Df den DfPr(F)
as.factor(X)   3 1.1922   6.5948 36360  2.2e-16 ***
Residuals  129
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 


I would like to store the values Df=3, Pillai=1.1922, P-value, etc. as a
vector. 

I have tried the following code that did not work:

 S=summary(M, test=Pillai)
S1-as.vector(S$Df, S$Pillai)

but I am getting an error every time. I have also tried just S$Df. Is there
a way to find out if Df and Pillai are correct headers to reference. For
example maybe it is df or degreesfreedom etc.

I know the concept works because I have used it for logistic regression.

 v1 - as.vector(exp(L1$coefficients))

The difference is that I know coefficients is the correct header to refer
to. 

--
View this message in context: 
http://r.789695.n4.nabble.com/Storing-data-from-a-test-as-a-vector-or-matrix-tp3495626p3495626.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] Storing data from a test as a vector or matrix

2011-05-04 Thread Ivan Calandra

Hi,

I would suggest you to check the structure of your summary object with 
str(), like this:

S - summary(M, test=Pillai)
str(S)

You will then see how to access each element of it.
If you cannot manage to do it yourself, then provide an example, or at 
least the output from str(s).
By the way, when you get an error, then copy it so that we have a better 
idea of what happens.


HTH,
Ivan




Le 5/4/2011 15:55, wwreith a écrit :

I just finished a MANOVA test and got the following output:


summary(M, test=Pillai)

 Df Pillai approx F num Df den DfPr(F)
as.factor(X)   3 1.1922   6.5948 36360  2.2e-16 ***
Residuals  129
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1


I would like to store the values Df=3, Pillai=1.1922, P-value, etc. as a
vector.

I have tried the following code that did not work:


S=summary(M, test=Pillai)
S1-as.vector(S$Df, S$Pillai)

but I am getting an error every time. I have also tried just S$Df. Is there
a way to find out if Df and Pillai are correct headers to reference. For
example maybe it is df or degreesfreedom etc.

I know the concept works because I have used it for logistic regression.

  v1- as.vector(exp(L1$coefficients))

The difference is that I know coefficients is the correct header to refer
to.

--
View this message in context: 
http://r.789695.n4.nabble.com/Storing-data-from-a-test-as-a-vector-or-matrix-tp3495626p3495626.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.



--
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calan...@uni-hamburg.de

**
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/1525_8_1.php

__
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] Storing data from a test as a vector or matrix

2011-05-04 Thread wwreith
SA gives the output:

Response IPS1 :
Df Sum Sq Mean Sq F value   Pr(F)
as.factor(WSD)   3 3.3136 1.10455  23.047 5.19e-12 ***
Residuals  129 6.1823 0.04793 
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 
.
.
.
There are 11 more just like this output. Just increment IPS1 to IPS2, etc.


Goal: save 3 3.3136 1.10455  23.047 5.19e-12 as a vector.


Str(SA) gives the output:

str(SA) 
 str(SA)   
List of 12  
 $  Response IPS1 :Classes 'anova' and 'data.frame':   2 obs. of  5
variables: 
  ..$ Df : num [1:2] 3 129  
  ..$ Sum Sq : num [1:2] 3.31 6.18  
  ..$ Mean Sq: num [1:2] 1.1045 0.0479  
  ..$ F value: num [1:2] 23 NA  
  ..$ Pr(F) : num [1:2] 5.19e-12 NA


There are several more but they are just repeats of this one only with IPS2,
IPS3,...

The command:

 SA1-as.vector(SA$Reponse IPS1)

Returns 

NULL

As do several variations I have tried. Any ideas. 

--
View this message in context: 
http://r.789695.n4.nabble.com/Storing-data-from-a-test-as-a-vector-or-matrix-tp3495626p3495950.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] Storing data from a test as a vector or matrix

2011-05-04 Thread wwreith
I figured out that attributes is the command that I was trying to find. It
allowed me to find out that I was needing to use stats not Df or
Pillai etc. Following command worked.

 S1-as.vector(S$stats[1,])

However when I try the same thing with summary.aov it is not working.

SA-summary.aov(M)
SA1-as.vector(SA$Reponse IPS1)

or 

SA1-as.vector(SA$Reponse IPS1[1,])


Using attributes command I get  Response IPS1. I have tried several
variations like including the first space in the quotes, deleting the space
between the two words, adding in [1,], etc. The error is stating unexpected
text. I have even tried using   which works for the stats line above but
does not work here.


Again thanks for any suggestions on what I am not understanding here. 


--
View this message in context: 
http://r.789695.n4.nabble.com/Storing-data-from-a-test-as-a-vector-or-matrix-tp3495626p3495901.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.