bugGNU Octave - Bugs: bug #43086, princomp() failed with one out...

 
 

bug #43086: princomp() failed with one out argument

Submitter:  None
Submitted:  Wed 27 Aug 2014 05:41:02 AM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Duplicate Assigned to:  None
Originator Name:  Tong Qu Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.8.1
Operating System:  * Mac OS Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 27 Aug 2014 06:04:35 AM UTC, comment #1: 

Thanks for your bug report. This bug has actually already been reported as bug #40893 and has been fixed in the statistics package repository. The fix will be released with the next version of the statistics package 1.2.4, or you can try using the current development copy of the princomp function available here:

http://sourceforge.net/p/octave/statistics/ci/default/tree/inst/princomp.m

Mike Miller <mtmiller>
Group Member
Wed 27 Aug 2014 05:41:02 AM UTC, original submission:  

package: statistics
version: 1.2.3
function: princomp()


octave:4> pkg load all
octave:5> COEFF = princomp(rand(100))
error: 'r' undefined near line 103 column 51
error: invalid limit value in colon expression
error: evaluating argument list element number 1
error: called from:
error:   /opt/local/share/octave/packages/statistics-1.2.3/princomp.m at line 103, column 13
octave:5>


I ckecked the 'princomp.m' file and did found there are something wrong with th e code:


   if nargout > 1

      # Get the Scores
      SCORE = Xcentered*COEFF;

      # Get the rank of the SCORE matrix
      r = rank(SCORE);

      # Only use the first r columns, pad rest with zeros if economy != 'econ'
      SCORE = SCORE(:,1:r) ;

      if !(nargin == 2 && strcmpi ( varargin{:} , "econ"))
            SCORE = [SCORE, zeros(nobs , nvars-r)];
      else
            COEFF   = COEFF(: , 1:r);
      endif

    endif

    # This is the same as the eigenvalues of the covariance matrix of X
    latent  = (diag(S'*S)/(size(Xcentered,1)-1))(1:r);

    if nargout > 2
      if !(nargin == 2 && strcmpi ( varargin{:} , "econ"))
          latent= [latent;zeros(nvars-r,1)];
      endif
    endif

    if nargout > 3
         # Calculate the Hotelling T-Square statistic for the observations
        tsquare = sumsq(zscore(SCORE(:,1:r)),2);
    endif


If there is only one input argument, the variable 'r' is then not defined.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Digest:
   bug dependencies.

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-08-27 mtmiller StatusNone Duplicate
        Open/ClosedOpen Closed
        Dependencies- Depends on bugs #40893

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code