View on
Daniel S. T. Hughes > Statistics-PCA-Varimax-0.0-2 > Statistics::PCA::Varimax



Annotate this POD

View/Report Bugs
Module Version: 0.0.2   Source  


Statistics::PCA::Varimax - A Perl implementation of Varimax rotation.


This document describes Statistics::PCA::Varimax version 0.0.2


    use Statistics::PCA::Varimax;
    # Each nested array ref corresponds to the loadings for a single factor.
    my $loadings = [
                        [qw/  0.28681878905  0.69807334810  0.74438876316  0.47052419229  0.68079195447  0.49817011866  0.86049803480  0.64178962603 0.29784558460 /],
                        [qw/  0.07560334830  0.15335493657 -0.40959477002  0.52231277744 -0.15586396086 -0.49832262559 -0.11502014276  0.32160898539 0.59537280152 /],
                        [qw/ -0.84084848877 -0.08371208961  0.02047721303 -0.13507580587  0.14832508991  0.25345619152 -0.01159349490 -0.04396749541 0.53340721684 /],

    # Calculate the rotated loadings and orthogonal matrix.
    my ($rotated_loadings_ref, $orthogonal_matrix_ref) = &rotate($loadings);

    print qq{\nRotated Loadings:\n};
    for my $c (0..$#{$rotated_loadings_ref->[0]}) { for my $r (0..$#{$rotated_loadings_ref}) { 
        #print qq{$rotated_loadings_ref->[$r][$c], and r: $r and c: $c\t} }; print qq{\n}; 
        print qq{$rotated_loadings_ref->[$r][$c]\t} }; print qq{\n}; 

    print qq{\nOrthogonal Matrix:\n};
    for my $r (0..$#{$orthogonal_matrix_ref}) { for my $c (0..$#{$orthogonal_matrix_ref->[$r]}) { 
        print qq{$orthogonal_matrix_ref->[$r][$c]\t} }; print qq{\n}; 


Varimax rotation is a change of coordinates used in principal component analysis and factor analysis that maximizes the sum of the variances of the squared loadings matrix. This module exports a single routine 'rotate'. This routine is called in LIST context and accepts a LIST-of-LISTS (LoL) corresponding to the loadings matrix of a factor analysis and returns two references to LoLs (NOTE: each nested LIST corresponds to the loadings for a single factor). The first is a LoL of the rotated loadings and the seconds is a LoL of the orthogonal matrix. See


'Math::GSL::Linalg::SVD' => '0.0.2', 'Math::MatrixReal' => '2.05', 'List::Util' => '1.22',


Daniel S. T. Hughes <>


Copyright (c) 2009, Daniel S. T. Hughes <>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.


Because this software is licensed free of charge, there is no warranty for the software, to the extent permitted by applicable law. Except when otherwise stated in writing the copyright holders and/or other parties provide the software "as is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the software is with you. Should the software prove defective, you assume the cost of all necessary servicing, repair, or correction.

In no event unless required by applicable law or agreed to in writing will any copyright holder, or any other party who may modify and/or redistribute the software as permitted by the above licence, be liable to you for damages, including any general, special, incidental, or consequential damages arising out of the use or inability to use the software (including but not limited to loss of data or data being rendered inaccurate or losses sustained by you or third parties or a failure of the software to operate with any other software), even if such holder or other party has been advised of the possibility of such damages.

syntax highlighting: