# [R] factanal {mva} question

Ben Bolker ben at zoo.ufl.edu
Thu Nov 22 13:16:52 CET 2001

```  The general answer to this kind of question is to look into the
print.factanal() function, which is what is called to do the printing
(by typing print.factanal , without parentheses or arguments, at the R
prompt).
in particular, the code contains ...

factors <- x\$factors
if (!is.na(x\$n.obs) && x\$dof > 0) {
dof <- x\$dof
stat <- (x\$n.obs - 1 - (2 * p + 5)/6 - (2 * factors)/3) *
x\$criteria["objective"]
cat("\nTest of the hypothesis that", factors, if (factors ==
1)
"factor is"
else "factors are", "sufficient.\n")
cat("The chi square statistic is", round(stat, 2), "on",
dof, if (dof == 1)
"degree"
else "degrees", "of freedom.\nThe p-value is", signif(1 -
pchisq(stat, dof), 3), "\n")
}

which shows you how those values are computed.

Often, there will be a summary method (which would be summary.factanal()
in this case, but it doesn't seem to exist) that computes a richer set of
summary statistics (e.g., summary.lm()) from which you could extract these
values directly, rather than computing them yourself.  You could write
your own summary.factanal() function, so that something like
summary(ability.FA)\$pvalue would work as expected.

On Thu, 22 Nov 2001, Nick Kostrov wrote:

> Hello!
>
> I have a question about the factanal function.
> This function returns at the end  test statistics like this:
>
> Test of the hypothesis that 4 factors are sufficient.
> The chi square statistic is 4.63 on 2 degrees of freedom.
> The p-value is 0.0988
>
>
> Is it possible to get the chi square statistic and the p-value as variables,
> not the text on the screen? An object of class "factanal" have no components
> of the p-value and the chi square statistic but the function print  them on
> the screen.
>
>
>
> Nick.
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>

--
318 Carr Hall                                bolker at zoo.ufl.edu
Zoology Department, University of Florida    http://www.zoo.ufl.edu/bolker
Box 118525                                   (ph)  352-392-5697
Gainesville, FL 32611-8525                   (fax) 352-392-3704

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```