[R] Returning the p-value of a factor analysis
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu May 8 11:15:10 CEST 2003
On Thu, 8 May 2003, Wayne Jones wrote:
> Does anyone know how to explicitly refer to the p-value of thet test that
> the chosen number of factors is significant in a factor analysis.
> It's not in the list of values for the factanal command output yet it is
> printed out with the results.
Right, so look at the code to compute it in print.factanal and write a
small function to extract the value you want from the object.
Something like
Pval.factanal <- function(x)
{
p <- nrow(x$loadings); 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"]
pchisq(stat, dof, lower.tail = FALSE)
} else NA
}
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list