Skip to content

Returning the p-value of a factor analysis

4 messages · Wayne Jones, Brian Ripley, Peter Dalgaard

#
On Thu, 8 May 2003, Wayne Jones wrote:

            
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
}
#
Wayne Jones <JonesW at kssg.com> writes:
It's calculated when printed. This is somewhat in bad style (according
to my tastes at least), but we have that happening in a few places. So
you need to redo the computations, which can be found inside
print.factanal. In 1.7.0, this function is hidden in the mva namespace
but you can view it with get("print.factanal",environment(factanal)).
#
Peter Dalgaard BSA <p.dalgaard at biostat.ku.dk> writes:
On closer thought, that should probably be

getS3method("print","factanal")