# doc-cache created by Octave 11.2.0
# name: cache
# type: cell
# rows: 3
# columns: 17
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 17
ReconstructionICA


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1865
 -- statistics: ReconstructionICA

     Reconstruction independent component analysis (RICA) feature-extraction
     model.

     A ReconstructionICA object stores the transformation learned by ‘rica’ for
     extracting features from data.  Create one with ‘rica’; apply it to data
     with the ‘transform’ method.

     An object of this class has the following properties:

        • TransformWeights: the P * Q matrix of learned transformation weights
          (unit-length columns).
        • Mu, Sigma: the per-predictor mean and standard deviation used when
          'Standardize' is true (empty otherwise), each a column vector with one
          entry per predictor.
        • FitInfo: a structure with the Iteration indices of the fit and the
          Objective value at each of them, both column vectors of the same
          length.  Iteration counts from zero and Objective(1) is the objective
          at the starting weights, so the last entry of each is the solution the
          fit returned.

          The values along that trajectory are this implementation's own.  Under
          the default 'quasinewton' solver the minimisation runs through
          Octave's ‘fminunc’; 'Solver', 'lbfgs' selects the limited-memory BFGS
          solver MATLAB uses.  Either way the steps taken from the same starting
          weights differ from MATLAB's, so the length of the history and the
          iteration counts differ, and on an objective this far from convex the
          optimum reached need not be MATLAB's either.
        • ModelParameters: a structure of the options used for the fit.
        • NumPredictors, NumLearnedFeatures: the input dimension P and the
          number of learned features Q.
        • InitialTransformWeights: the starting weights used by the fit.

     See also: rica, sparsefilt.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 78
Reconstruction independent component analysis (RICA) feature-extraction model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
SparseFiltering


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1800
 -- statistics: SparseFiltering

     Sparse filtering feature-extraction model.

     A SparseFiltering object stores the transformation learned by ‘sparsefilt’
     for extracting features from data.  Create one with ‘sparsefilt’; apply it
     to data with the ‘transform’ method.

     An object of this class has the following properties:

        • TransformWeights: the P * Q matrix of learned transformation weights.
        • Mu, Sigma: the per-predictor mean and standard deviation used when
          'Standardize' is true (empty otherwise), each a column vector with one
          entry per predictor.
        • FitInfo: a structure with the Iteration indices of the fit and the
          Objective value at each of them, both column vectors of the same
          length.  Iteration counts from zero and Objective(1) is the objective
          at the starting weights, so the last entry of each is the solution the
          fit returned.

          The values along that trajectory are this implementation's own.  Under
          the default 'quasinewton' solver the minimisation runs through
          Octave's ‘fminunc’; 'Solver', 'lbfgs' selects the limited-memory BFGS
          solver MATLAB uses.  Either way the steps taken from the same starting
          weights differ from MATLAB's, so the length of the history and the
          iteration counts differ, and on an objective this far from convex the
          optimum reached need not be MATLAB's either.
        • ModelParameters: a structure of the options used for the fit.
        • NumPredictors, NumLearnedFeatures: the input dimension P and the
          number of learned features Q.
        • InitialTransformWeights: the starting weights used by the fit.

     See also: sparsefilt, rica.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
Sparse filtering feature-extraction model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
canoncorr


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 535
 -- statistics: [A, B, R, U, V] = canoncorr (X, Y)

     Canonical correlation analysis.

     Given X (size K*M) and Y (K*N), returns projection matrices of canonical
     coefficients A (size M*D, where D is the smallest of M, N, D) and B (size
     M*D); the canonical correlations R (1*D, arranged in decreasing order); the
     canonical variables U, V (both K*D, with orthonormal columns); and STATS, a
     structure containing results from Bartlett's chi-square and Rao's F tests
     of significance.

     See also: princomp.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
Canonical correlation analysis.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
cmdscale


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3142
 -- statistics: Y = cmdscale (D)
 -- statistics: [Y, E] = cmdscale (D)
 -- statistics: Y = cmdscale (D, P)
 -- statistics: [Y, E] = cmdscale (D, P)

     Classical multidimensional scaling of a matrix.

     Takes an N by N distance (or difference, similarity, or dissimilarity)
     matrix D.  Returns Y, a matrix of N points with coordinates in P
     dimensional space which approximate those distances (or differences,
     similarities, or dissimilarities).  Also returns the eigenvalues E of ‘B =
     -1/2 * J * (D.^2) * J’, where ‘J = eye(N) - ones(N,N)/N’.  P, the number of
     columns of Y, is equal to the number of positive real eigenvalues of B.

     The optional argument P is a positive integer between 1 and N that
     specifies the maximum dimensionality of the desired embedding Y.  If
     specified, Y will have at most P columns, and the returned eigenvalues E
     will be a vector of exactly length P.  Specifying P can be useful for
     reducing dimensions for visualization (e.g., ‘P = 2’).

     D can be a full or sparse matrix or a vector of length ‘N*(N-1)/2’
     containing the upper triangular elements (like the output of the ‘pdist’
     function).  It must be symmetric with non-negative entries whose values are
     further restricted by the type of matrix being represented:

     * If D is either a distance, dissimilarity, or difference matrix, then it
     must have zero entries along the main diagonal.  In this case the points Y
     equal or approximate the distances given by D.

     * If D is a similarity matrix, the elements must all be less than or equal
     to one, with ones along the main diagonal.  In this case the points Y equal
     or approximate the distances given by ‘D = sqrt(ones(N,N)-D)’.

     D is a Euclidean matrix if and only if B is positive semi-definite.  When
     this is the case, then Y is an exact representation of the distances given
     in D.  If D is non-Euclidean, Y only approximates the distance given in D.
     The approximation used by ‘cmdscale’ minimizes the statistical loss
     function known as STRAIN.

     The returned Y is an N by P matrix showing possible coordinates of the
     points in P dimensional space (‘P < N’).  The columns correspond to the
     positive eigenvalues of B in descending order.  A translation, rotation, or
     reflection of the coordinates given by Y will satisfy the same distance
     matrix up to the limits of machine precision.

     For any ‘K <= P’, if the largest K positive eigenvalues of B are
     significantly greater in absolute magnitude than its other eigenvalues, the
     first K columns of Y provide a K-dimensional reduction of Y which
     approximates the distances given by D.  The optional return E can be used
     to consider various values of K, or to evaluate the accuracy of specific
     dimension reductions (e.g., ‘K = 2’).

     Reference: Ingwer Borg and Patrick J.F. Groenen (2005), Modern
     Multidimensional Scaling, Second Edition, Springer, ISBN: 978-0-387-25150-9
     (Print) 978-0-387-28981-6 (Online)

     See also: pdist.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
Classical multidimensional scaling of a matrix.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
factoran


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6129
 -- statistics: LAMBDA = factoran (X, M)
 -- statistics: [LAMBDA, PSI] = factoran (X, M)
 -- statistics: [LAMBDA, PSI, T] = factoran (X, M)
 -- statistics: [LAMBDA, PSI, T, STATS] = factoran (X, M)
 -- statistics: [LAMBDA, PSI, T, STATS, F] = factoran (X, M)
 -- statistics: [...] = factoran (..., NAME, VALUE)

     Common factor analysis.

     ‘LAMBDA = factoran (X, M)’ fits the common factor model with M common
     factors to the N-by-P data matrix X, whose rows are observations and
     columns are variables, and returns the P-by-M matrix LAMBDA of factor
     loadings.  The model is

          X = MU + LAMBDA * F + E

     where F are the common factors and E the variable-specific errors,
     uncorrelated with each other and with F.  The analysis is carried out on
     the correlation matrix, so the loadings are in standardized units and a
     variable's communality ‘sum (LAMBDA(i,:) .^ 2)’ and its specific variance
     ‘PSI(i)’ sum to one.

     ‘[LAMBDA, PSI] = factoran (...)’ also returns the P-by-1 vector PSI of
     specific variances.

     ‘[LAMBDA, PSI, T] = factoran (...)’ also returns the M-by-M rotation matrix
     T that was applied to the loadings.  It is the identity when 'Rotate' is
     'none'.

     ‘[LAMBDA, PSI, T, STATS] = factoran (...)’ also returns a structure STATS
     with the fields

     Field        Description
     ------------------------------------------------------------------------------
     loglike      the maximized log-likelihood, up to a constant.
     dfe          the error degrees of freedom, ‘((P - M)^2 - P - M) / 2’.
     chisq        the likelihood ratio statistic testing M common factors
                  against an unrestricted covariance.
     p            the significance of CHISQ.

     The last two are present only when they can be computed: they are omitted
     when the degrees of freedom are not positive, when a specific variance has
     reached its lower bound (a Heywood case, where the likelihood is on the
     boundary), and for the 'paf' extraction, which does not maximize a
     likelihood.  Test for them with ‘isfield’ before using them.

     ‘[LAMBDA, PSI, T, STATS, F] = factoran (...)’ also returns the N-by-M
     matrix F of predicted factor scores.  Scores are not available from a
     covariance matrix, only from data.

     Name-Value pairs
     ----------------

     Name           Value
     ------------------------------------------------------------------------------
     'Extraction'   How the loadings are estimated, either 'ml' (default) for
                    maximum likelihood or 'paf' for principal axis factoring.
                    *An Octave extension*; MATLAB fits by maximum likelihood
                    only.  See the note below.
                    
     'Xtype'        Whether X holds 'data' (default) or a 'covariance' (or
                    correlation) matrix.
                    
     'Nobs'         The number of observations behind a covariance matrix.
                    Required for STATS when 'Xtype' is 'covariance'.
                    
     'Delta'        The lower bound on the specific variances, a scalar in ‘[0,
                    1)’ (default ‘0.005’).  Bounding them away from zero keeps
                    the likelihood finite; a solution that reaches the bound is
                    a Heywood case and is reported by a warning.
                    
     'Rotate'       The rotation applied to the loadings, passed to
                    ‘rotatefactors’: 'varimax' (default), 'none', 'quartimax',
                    'equamax', 'parsimax', 'orthomax', or 'promax'.
                    
     'Normalize'    Whether the rotation normalizes the rows of the loadings
                    (Kaiser normalization), 'on' (default) or 'off'.
                    
     'Power'        The exponent of the 'promax' target, a scalar not less than
                    1 (default 4).
                    
     'Scores'       How F is predicted, either 'wls' (default, also named
                    'Bartlett') or 'regression' (also named 'Thomson').
                    
     'Maxit'        The iteration limit of the extraction (default ‘500’).
                    
     'Tolerance'    The convergence tolerance of the extraction (default
                    ‘1e-8’).

     Choosing the extraction
     -----------------------

     The two extractions fit the same model but estimate it differently, and
     they answer to different circumstances.

     'ml' maximizes the likelihood of a multivariate normal, and is what
     MATLAB's ‘factoran’ does.  Use it when you want the likelihood ratio test
     in STATS to decide how many factors the data support, and when the data are
     plausibly normal.  It can fail to converge, or push a specific variance to
     zero, when the model asks for more factors than the data hold.

     'paf' iterates communalities on the reduced correlation matrix.  It makes
     no distributional assumption and is stable where maximum likelihood
     struggles, which is why it remains available here, but it provides no
     likelihood and therefore no test: STATS carries only dfe.

     The two agree closely when the model fits the data well and diverge when it
     does not, so a large difference between them is itself informative.

     Number of factors
     -----------------

     M must leave the model identified, that is ‘(P - M)^2 >= P + M’.  With six
     variables at most three factors can be fitted, and only the smaller counts
     leave degrees of freedom to test.

     References
     ----------

       1. Lawley, D. N., and Maxwell, A. E., ‘Factor Analysis as a Statistical
          Method’, 2nd Edition, Butterworths, 1971.

       2. Joreskog, K. G., "Some contributions to maximum likelihood factor
          analysis", ‘Psychometrika’ 32(4), 443-482, 1967.

       3. Harman, H. H., ‘Modern Factor Analysis’, 3rd Edition, University of
          Chicago Press, 1976.

     See also: rotatefactors, pca, pcacov, princomp, barttest.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
Common factor analysis.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
mdscale


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3907
 -- statistics: Y = mdscale (D, P)
 -- statistics: [Y, STRESS] = mdscale (D, P)
 -- statistics: [Y, STRESS, DISPARITIES] = mdscale (D, P)
 -- statistics: [...] = mdscale (..., NAME, VALUE)

     Nonclassical (metric and nonmetric) multidimensional scaling.

     ‘Y = mdscale (D, P)’ takes a matrix of dissimilarities D and returns a
     configuration Y of N points in P dimensions (an N * P matrix) whose
     interpoint distances approximate D, by minimizing a stress criterion.  D
     may be given either as a full N * N symmetric matrix with zero diagonal, or
     as the vector of the N (N - 1) / 2 upper-triangle dissimilarities returned
     by ‘pdist’.

     ‘[Y, STRESS, DISPARITIES] = mdscale (...)’ also returns the final value of
     the STRESS criterion and the DISPARITIES (the transformed dissimilarities
     the distances are fitted to).  For the nonmetric criteria the disparities
     are the monotone (isotonic) regression of the dissimilarities onto the
     distances; for the metric criteria they are the dissimilarities themselves.

     Name/Value pairs:

     'Criterion'
          The goodness-of-fit criterion to minimize, one of:

          'stress' (default)
               Kruskal's normalized stress-1, sqrt (sum ((d - dhat)^2) / sum
               (d^2)), computed from disparities DHAT (nonmetric).

          'sstress'
               Squared stress, sqrt (sum ((d^2 - dhat^2)^2) / sum (d^4))
               (nonmetric).

          'metricstress'
               Metric stress, sqrt (sum ((d - delta)^2) / sum (delta^2)),
               fitting the dissimilarities DELTA directly.

          'metricsstress'
               Metric squared stress, sqrt (sum ((d^2 - delta^2)^2) / sum
               (delta^4)).

          'sammon'
               Sammon's nonlinear mapping criterion, (1 / sum (delta)) sum ((d -
               delta)^2 / delta).

          'strain'
               The classical scaling criterion; equivalent to ‘cmdscale’.

     'Weights'
          A matrix or vector of nonnegative weights, the same size as D,
          weighting each dissimilarity in the criterion.

     'Start'
          The initial configuration: 'cmdscale' (default, classical scaling),
          'random', or an explicit N * P matrix.

     'Replicates'
          The number of times to repeat the minimization from different starting
          points, keeping the best (lowest-stress) result.  The default is 1.

     'Options'
          A structure of algorithm options (as returned by ‘statset’) whose
          MaxIter, TolFun, and TolX fields control the iterative minimization.

     Non-uniqueness of the solution
     ------------------------------

     A stress-minimizing configuration is defined only up to a translation,
     rotation, and reflection, because these leave all interpoint distances (and
     hence the stress) unchanged.  ‘mdscale’ removes this ambiguity by returning
     Y centred at the origin and rotated to its principal axes (with the
     largest-magnitude coordinate on each axis made positive), matching the
     convention used by MATLAB.

     Beyond that rigid ambiguity, the *nonmetric* criteria ('stress' and
     'sstress') are non-convex and typically have several local minima; the one
     reached depends on the starting configuration and the details of the
     optimizer.  As a result the returned configuration for these criteria may
     differ from the one another program (including MATLAB) reports even when
     the *stress value* agrees, and different runs may find configurations with
     slightly different stress.  Use 'Replicates' with a 'random' start to
     search for a lower-stress solution.  The metric criteria and 'strain' have
     an essentially unique solution and are reproducible up to the rigid
     ambiguity above.

     See also: cmdscale, pdist, squareform, procrustes, statset.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 61
Nonclassical (metric and nonmetric) multidimensional scaling.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 4
nnmf


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1895
 -- statistics: [W, H] = nnmf (A, K)
 -- statistics: [W, H, D] = nnmf (A, K)
 -- statistics: [...] = nnmf (..., NAME, VALUE)

     Nonnegative matrix factorization.

     ‘[W, H] = nnmf (A, K)’ factors the nonnegative N * M matrix A into
     nonnegative factors W (N * K) and H (K * M) whose product approximates A,
     by minimizing the root-mean-square residual between A and ‘W * H’.  K, the
     number of factors, is typically smaller than N and M.

     ‘[W, H, D] = nnmf (...)’ also returns the root-mean-square residual D, that
     is ‘norm (A - W * H, "fro") / sqrt (N * M)’.

     The factorization is not unique: the returned factors are normalized so
     that the rows of H have unit length, and the columns of W (and the
     corresponding rows of H) are ordered by decreasing length of the columns of
     W.  Because the objective is not convex, the iteration converges to a local
     minimum that depends on the starting point; use 'Replicates' to try several
     random starts and keep the best.

     Name/Value pairs:

     'Algorithm'
          'als' (default) for alternating least squares, or 'mult' for
          multiplicative updates.  Alternating least squares usually converges
          faster and more reliably; multiplicative updates are more sensitive to
          the starting point.

     'W0'
          An N * K initial value for W.

     'H0'
          A K * M initial value for H.

     'Replicates'
          The number of times to repeat the factorization from new random
          starting points, keeping the result with the smallest residual.  The
          default is 1.  Ignored for a starting point fixed by both 'W0' and
          'H0'.

     'Options'
          A structure of algorithm options (as returned by ‘statset’) whose
          MaxIter, TolFun, and TolX fields control the iteration.

     See also: pca, statset.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
Nonnegative matrix factorization.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3
pca


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3389
 -- statistics: COEFF = pca (X)
 -- statistics: COEFF = pca (X, NAME, VALUE)
 -- statistics: [COEFF, SCORE, LATENT] = pca (...)
 -- statistics: [COEFF, SCORE, LATENT, TSQUARED] = pca (...)
 -- statistics: [COEFF, SCORE, LATENT, TSQUARED, EXPLAINED, MU] = pca (...)

     Performs a principal component analysis on a data matrix.

     A principal component analysis of a data matrix of N observations in a D
     dimensional space returns a D*D transformation matrix, to perform a change
     of basis on the data.  The first component of the new basis is the
     direction that maximizes the variance of the projected data.

     Input argument:
        • X : a N*D data matrix

     The following NAME, VALUE pair arguments can be used:
        • 'Algorithm' defines the algorithm to use:
             • 'svd' (default), for singular value decomposition
             • 'eig' for eigenvalue decomposition

        • 'Centered' is a boolean indicator for centering the observation data.
          It is ‘true’ by default.
        • 
          'Economy' is a boolean indicator for the economy size output.  It is
          ‘true’ by default.  Hence, ‘pca’ returns only the elements of LATENT
          that are not necessarily zero, and the corresponding columns of COEFF
          and SCORE, that is, when N <= D, only the first N - 1.

        • 'NumComponents' defines the number of components k to return.  If k <
          p, then only the first k columns of COEFF and SCORE are returned.

        • 'Rows' defines how to handle missing values:
             • 'complete' (default), missing values are removed before
               computation.
             • 'pairwise' (only valid when 'Algorithm' is 'eig'), the covariance
               of rows with missing data is computed using the available data,
               but the covariance matrix could be not positive definite, which
               triggers the termination of ‘pca’.
             • 'all', missing values are not allowed, ‘pca’ terminates with an
               error if there are any.

        • 'Weights' defines observation weights as a vector of positive values
          of length N.

        • 'VariableWeights' defines variable weights:
             • a VECTOR of positive values of length D.
             • the string 'variance' to use the sample variance as weights.

     Return values:
        • COEFF : the principal component coefficients, a D*D transformation
          matrix
        • SCORE : the principal component scores, the representation of X in the
          principal component space
        • LATENT : the principal component variances, i.e., the eigenvalues of
          the covariance matrix of X
        • TSQUARED : Hotelling's T-squared Statistic for each observation in X
        • EXPLAINED : the percentage of the variance explained by each principal
          component
        • MU : the estimated mean of each variable of X, it is zero if the data
          are not centered

     Matlab compatibility note: the alternating least square method 'als' and
     associated options 'Coeff0', 'Score0', and 'Options' are not yet
     implemented

     References
     ----------

       1. Jolliffe, I. T., Principal Component Analysis, 2nd Edition, Springer,
          2002

     See also: barttest, factoran, pcacov, pcares.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 57
Performs a principal component analysis on a data matrix.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
pcacov


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1482
 -- statistics: COEFF = pcacov (K)
 -- statistics: [COEFF, LATENT] = pcacov (K)
 -- statistics: [COEFF, LATENT, EXPLAINED] = pcacov (K)

     Perform principal component analysis on covariance matrix

     ‘COEFF = pcacov (K)’ performs principal component analysis on the square
     covariance matrix K and returns the principal component coefficients, also
     known as loadings.  The columns are in order of decreasing component
     variance.

     ‘[COEFF, LATENT] = pcacov (K)’ also returns a vector with the principal
     component variances, i.e.  the eigenvalues of K.  LATENT has a length of
     size (COEFF, 1).

     ‘[COEFF, LATENT, EXPLAINED] = pcacov (K)’ also returns a vector with the
     percentage of the total variance explained by each principal component.
     EXPLAINED has the same size as LATENT.  The entries in EXPLAINED range from
     0 (none of the variance is explained) to 100 (all of the variance is
     explained).

     ‘pcacov’ does not standardize K to have unit variances.  In order to
     perform principal component analysis on standardized variables, use the
     correlation matrix R = K ./ (SD * SD'), where SD = sqrt (diag (K)), in
     place of K.  To perform principal component analysis directly on the data
     matrix, use ‘pca’.

     References
     ----------

       1. Jolliffe, I. T., Principal Component Analysis, 2nd Edition, Springer,
          2002

     See also: barttest, factoran, pcares, pca.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 57
Perform principal component analysis on covariance matrix



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
pcares


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1299
 -- statistics: RESIDUALS = pcares (X, NDIM)
 -- statistics: [RESIDUALS, RECONSTRUCTED] = pcares (X, NDIM)

     Calculate residuals from principal component analysis.

     ‘RESIDUALS = pcares (X, NDIM)’ returns the residuals obtained by retaining
     NDIM principal components of the N*D matrix X.  Rows of X correspond to
     observations, columns of X correspond to variables.  NDIM is a scalar and
     must be less than or equal to D. RESIDUALS is a matrix of the same size as
     X.  Use the data matrix, not the covariance matrix, with this function.

     ‘[RESIDUALS, RECONSTRUCTED] = pcares (X, NDIM)’ returns the reconstructed
     observations, i.e.  the approximation to X obtained by retaining its first
     NDIM principal components.

     ‘pcares’ does not normalize the columns of X.  Use pcares (zscore (X),
     NDIM) in order to perform the principal components analysis based on
     standardized variables, i.e.  based on correlations.  Use ‘pcacov’ in order
     to perform principal components analysis directly on a covariance or
     correlation matrix without constructing residuals.

     References
     ----------

       1. Jolliffe, I. T., Principal Component Analysis, 2nd Edition, Springer,
          2002

     See also: factoran, pcacov, pca.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 54
Calculate residuals from principal component analysis.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 4
ppca


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 2480
 -- statistics: COEFF = ppca (Y, K)
 -- statistics: [COEFF, SCORE] = ppca (Y, K)
 -- statistics: [COEFF, SCORE, PCVAR] = ppca (Y, K)
 -- statistics: [COEFF, SCORE, PCVAR, MU] = ppca (Y, K)
 -- statistics: [COEFF, SCORE, PCVAR, MU, V] = ppca (Y, K)
 -- statistics: [COEFF, SCORE, PCVAR, MU, V, S] = ppca (Y, K)
 -- statistics: [...] = ppca (..., NAME, VALUE)

     Probabilistic principal component analysis.

     ‘COEFF = ppca (Y, K)’ fits a probabilistic principal component analysis
     (PPCA) model with K components to the N * P data matrix Y (rows are
     observations, columns are variables) and returns the P * K matrix COEFF of
     orthonormal principal component coefficients, ordered by decreasing
     component variance.  Y may contain ‘NaN’ values marking missing
     observations; the model is fitted by an expectation-maximization algorithm
     that accounts for them.  K must be a positive integer smaller than P.

     ‘[COEFF, SCORE, PCVAR, MU, V, S] = ppca (...)’ returns further outputs:

     SCORE
          The N * K principal component scores (the data projected onto the
          components; missing entries are reconstructed from the model before
          projection).

     PCVAR
          A K * 1 vector of the principal component variances (the variance
          explained by each component).

     MU
          A 1 * P vector of the estimated mean of Y.

     V
          The estimated residual (isotropic noise) variance.

     S
          A structure with the fitted model details: the loadings W, the
          expected scores Xexp, the reconstruction Recon, the number of
          iterations NumIter, and the root-mean-square residual RMSResid.

     Name/Value pairs control the fit:

     'W0'
          A P * K initial value for the loadings used by the
          expectation-maximization algorithm (missing-data case).

     'Options'
          A structure of algorithm options, as returned by ‘statset’, whose
          MaxIter, TolFun, and TolX fields set the maximum number of iterations
          and the convergence tolerances of the expectation-maximization
          algorithm.

     When Y has no missing values the model is fitted directly from the
     eigendecomposition of its covariance matrix; COEFF, PCVAR, and V are then
     the principal component directions, the leading variances, and the mean of
     the trailing variances, respectively.

     See also: pca, pcacov, pcares, factoran, barttest.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
Probabilistic principal component analysis.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
princomp


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1237
 -- statistics: COEFF = princomp (X)
 -- statistics: [COEFF, SCORE] = princomp (X)
 -- statistics: [COEFF, SCORE, LATENT] = princomp (X)
 -- statistics: [COEFF, SCORE, LATENT, TSQUARE] = princomp (X)
 -- statistics: [...] = princomp (X, "econ")

     Performs a principal component analysis on a NxP data matrix X.

        • COEFF : returns the principal component coefficients
        • SCORE : returns the principal component scores, the representation of
          X in the principal component space
        • LATENT : returns the principal component variances, i.e., the
          eigenvalues of the covariance matrix X.
        • TSQUARE : returns Hotelling's T-squared Statistic for each observation
          in X
        • [...]  = princomp(X,'econ') returns only the elements of latent that
          are not necessarily zero, and the corresponding columns of COEFF and
          SCORE, that is, when n <= p, only the first n-1.  This can be
          significantly faster when p is much larger than n.  In this case the
          svd will be applied on the transpose of the data matrix X

     References
     ----------

       1. Jolliffe, I. T., Principal Component Analysis, 2nd Edition, Springer,
          2002


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 63
Performs a principal component analysis on a NxP data matrix X.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
procrustes


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 2430
 -- statistics: D = procrustes (X, Y)
 -- statistics: D = procrustes (X, Y, PARAM1, VALUE1, ...)
 -- statistics: [D, Z] = procrustes (...)
 -- statistics: [D, Z, TRANSFORM] = procrustes (...)

     Procrustes Analysis.

     ‘D = procrustes (X, Y)’ computes a linear transformation of the points in
     the matrix Y to best conform them to the points in the matrix X by
     minimizing the sum of squared errors, as the goodness of fit criterion,
     which is returned in D as a dissimilarity measure.  D is standardized by a
     measure of the scale of X, given by
        • sum (sum ((X - repmat (mean (X, 1), size (X, 1), 1)) .^ 2, 1))
     i.e., the sum of squared elements of a centered version of X.  However, if
     X comprises repetitions of the same point, the sum of squared errors is not
     standardized.

     X and Y must have the same number of points (rows) and procrustes matches
     the i-th point in Y to the i-th point in X.  Points in Y can have smaller
     dimensions (columns) than those in X, but not the opposite.  Missing
     dimensions in Y are added with padding columns of zeros as necessary to
     match the the dimensions in X.

     ‘[D, Z] = procrustes (X, Y)’ also returns the transformed values in Y.

     ‘[D, Z, TRANSFORM] = procrustes (X, Y)’ also returns the transformation
     that maps Y to Z.

     TRANSFORM is a structure with fields:

     c        the translation component
     T        the orthogonal rotation and reflection component
     b        the scale component

     So that ‘Z = TRANSFORM.b * Y * TRANSFORM.T + TRANSFORM.c’

     procrustes can take two optional parameters as Name-Value pairs.

     ‘[...] = procrustes (..., 'Scaling', false)’ computes a transformation that
     does not include scaling, that is TRANSFORM.b = 1.  Setting 'Scaling' to
     true includes a scaling component, which is the default.

     ‘[...] = procrustes (..., 'Reflection', false)’ computes a transformation
     that does not include a reflection component, that is TRANSFORM.T = 1.
     Setting 'Reflection' to true forces the solution to include a reflection
     component in the computed transformation, that is TRANSFORM.T = -1.

     ‘[...] = procrustes (..., 'Reflection', 'best')’ computes the best fit
     procrustes solution, which may or may not include a reflection component,
     which is the default.

     See also: cmdscale.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
Procrustes Analysis.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 4
rica


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 2845
 -- statistics: MDL = rica (X, Q)
 -- statistics: MDL = rica (X, Q, NAME, VALUE)

     Reconstruction independent component analysis (RICA) for feature
     extraction.

     ‘MDL = rica (X, Q)’ learns Q features from the N * P data matrix X (rows
     are observations, columns are predictors) and returns a ReconstructionICA
     object MDL.  Apply the learned transformation to data with ‘transform (MDL,
     X)’, which returns ‘X * MDL.TransformWeights’.

     The P * Q weight matrix (with unit-length columns) minimizes the objective

          LAMBDA * ||X * W * W' - X||_F^2
                + sum (sum (G (X * W)))

     over the transformation weights W, combining a reconstruction cost with a
     sparsity contrast G applied elementwise and selected by 'ContrastFcn'.

     Name/Value pairs:

     'IterationLimit'
          Maximum number of iterations (default 1000).

     'Lambda'
          Weight of the reconstruction term (default 1).

     'Standardize'
          Logical; center and scale each predictor before fitting (default
          false).

     'ContrastFcn'
          The sparsity contrast G applied to each element z of X * W: 'logcosh'
          (default), which is 0.5 * log (cosh (2 * z)); 'exp', which is -exp
          (-z^2 / 2); or 'sqrt', which is sqrt (z^2 + 1e-8), a smooth stand-in
          for abs (z).

     'InitialTransformWeights'
          A P * Q initial value for the weights.  The default is random.

     'GradientTolerance', 'StepTolerance'
          Stop once the gradient's or the step's infinity norm falls to or below
          the given value (default 1e-6 each).  They govern the fit only under
          'Solver', 'lbfgs'; the 'quasinewton' solver runs to its own tighter
          internal tolerances and records these without acting on them.

     'Solver'
          'quasinewton' (default) minimizes through Octave's ‘fminunc’, which
          carries a full inverse Hessian.  'lbfgs' selects the limited-memory
          BFGS solver MATLAB uses, holding as many curvature pairs as the
          transform has parameters, and is several times faster here.  It stops
          where 'GradientTolerance' and 'StepTolerance' say to, so a value
          tighter than the default carries it further.

     Note on reproducibility
     -----------------------

     The RICA objective is not convex and is minimized by a quasi-Newton solver,
     so the learned weights depend on the starting point and the solver, and are
     only defined up to a permutation and sign of the feature columns.
     Different runs (or different software, including MATLAB) may return
     different weights that nonetheless describe an equally valid feature
     transformation.  Fix 'InitialTransformWeights' for a reproducible result.

     See also: ReconstructionICA, sparsefilt, pca.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 76
Reconstruction independent component analysis (RICA) for feature extraction.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
rotatefactors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3327
 -- statistics: B = rotatefactors (A)
 -- statistics: B = rotatefactors (A, NAME, VALUE, ...)
 -- statistics: [B, T] = rotatefactors (...)

     Rotate a factor-loading matrix.

     ‘B = rotatefactors (A)’ rotates the D * M factor loadings matrix A (D
     observed variables, M factors) to the 'varimax' criterion and returns the
     rotated loadings B, the same size as A.

     ‘[B, T] = rotatefactors (...)’ also returns the M * M rotation matrix T, so
     that ‘B = A * T’.  For the orthogonal methods T is orthonormal (‘T' * T’ is
     the identity); for the oblique methods ('promax' and oblique 'procrustes')
     it is a general invertible matrix.

     The rotation is controlled by NAME/VALUE pairs:

     'Method'
          The rotation criterion, one of:

          'varimax' (default)
               Orthomax with a criterion coefficient of 1; maximizes the
               variance of the squared loadings within each factor.

          'quartimax'
               Orthomax with a coefficient of 0; simplifies the description of
               each variable.

          'equamax'
               Orthomax with a coefficient of M / 2.

          'parsimax'
               Orthomax with a coefficient of D (M - 1) / (D + M - 2).

          'orthomax'
               General orthomax with the coefficient given by 'Coeff'.

          'promax'
               Oblique rotation obtained by fitting an oblique transformation to
               a target built from a 'varimax' solution raised to the power
               'Power'.

          'procrustes'
               Rotation towards the 'Target' matrix, either orthogonal or
               oblique according to 'Type'.

     'Normalize'
          'on' (default) applies Kaiser normalization (each row of A is scaled
          to unit length before the orthomax rotation and unscaled afterwards);
          'off' disables it.  Ignored by 'procrustes'.

     'Reltol'
          Relative convergence tolerance for the iterative orthomax rotation.
          The default is ‘sqrt (eps)’.

     'Maxit'
          Maximum number of iterations for the iterative orthomax rotation.  The
          default is 250.

     'Coeff'
          The orthomax coefficient used when 'Method' is 'orthomax'.  The
          default is 1 (equivalent to 'varimax').

     'Power'
          The power used to build the 'promax' target, a scalar greater than or
          equal to 1.  The default is 4.

     'Target'
          The target loadings matrix for 'procrustes', the same size as A.
          Required for that method.

     'Type'
          'oblique' (default) or 'orthogonal', selecting the kind of
          'procrustes' rotation.  The default follows MATLAB, whose 'procrustes'
          rotation is oblique unless told otherwise.

     *Note on the orthomax family:* for coefficients up to 1 ('varimax',
     'quartimax', and small 'orthomax') the rotation follows the same
     successive-SVD iteration as MATLAB and stops at the same relative
     tolerance.  For larger coefficients ('equamax', 'parsimax') that iteration
     does not converge, so a monotonically convergent pairwise algorithm is used
     instead; it reaches the same optimum as MATLAB to that solution's own
     convergence precision.

     See also: factoran, pca, pcacov, procrustes.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
Rotate a factor-loading matrix.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
sparsefilt


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 2503
 -- statistics: MDL = sparsefilt (X, Q)
 -- statistics: MDL = sparsefilt (X, Q, NAME, VALUE)

     Sparse filtering for feature extraction.

     ‘MDL = sparsefilt (X, Q)’ learns Q features from the N * P data matrix X
     (rows are observations, columns are predictors) and returns a
     SparseFiltering object MDL.  Apply the learned transformation to data with
     ‘transform (MDL, X)’.

     The N * Q features returned by ‘transform’ are the soft-absolute
     activations ‘sqrt ((X * W) .^ 2 + 1e-8)’, normalized first across
     observations (each feature) and then across features (each observation).
     The P * Q weight matrix W minimizes the sum of those features plus an L2
     penalty ‘LAMBDA * ||W ||_F^2’, driving the features to be sparse.

     Name/Value pairs:

     'IterationLimit'
          Maximum number of iterations (default 1000).

     'Lambda'
          Weight of the L2 penalty on the transform weights (default 1).

     'Standardize'
          Logical; center and scale each predictor before fitting (default
          false).

     'InitialTransformWeights'
          A P * Q initial value for the weights.  The default is random.

     'GradientTolerance', 'StepTolerance'
          Stop once the gradient's or the step's infinity norm falls to or below
          the given value (default 1e-6 each).  They govern the fit only under
          'Solver', 'lbfgs'; the 'quasinewton' solver runs to its own tighter
          internal tolerances and records these without acting on them.

     'Solver'
          'quasinewton' (default) minimizes through Octave's ‘fminunc’, which
          carries a full inverse Hessian.  'lbfgs' selects the limited-memory
          BFGS solver MATLAB uses, holding as many curvature pairs as the
          transform has parameters, and is several times faster here.  It stops
          where 'GradientTolerance' and 'StepTolerance' say to, so a value
          tighter than the default carries it further.

     Note on reproducibility
     -----------------------

     The sparse filtering objective is not convex and is minimized by a
     quasi-Newton solver, so the learned weights depend on the starting point
     and the solver.  Different runs (or different software, including MATLAB)
     may return different weights that nonetheless describe an equally valid
     feature transformation.  Fix 'InitialTransformWeights' for a reproducible
     result.

     See also: SparseFiltering, rica, pca.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
Sparse filtering for feature extraction.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 4
tsne


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3400
 -- statistics: Y = tsne (X)
 -- statistics: [Y, LOSS] = tsne (X)
 -- statistics: [...] = tsne (..., NAME, VALUE)

     t-distributed stochastic neighbor embedding (t-SNE).

     ‘Y = tsne (X)’ embeds the N * P data matrix X (rows are observations) into
     a low-dimensional space and returns the N * NUMDIMENSIONS matrix Y of
     embedded points, whose pairwise (Student-t) affinities approximate the
     Gaussian affinities of the rows of X.

     ‘[Y, LOSS] = tsne (...)’ also returns the Kullback-Leibler divergence LOSS
     between the two affinity distributions at the returned embedding.

     Name/Value pairs:

     'Algorithm'
          'exact' (default) forms the affinities and the gradient over every
          pair of points, which costs O(N^2) in time and memory at each
          iteration.  'barneshut' approximates both: the high-dimensional
          affinities are kept only over each point's 3 * Perplexity nearest
          neighbours, and the repulsive part of the gradient is summed over a
          space-partitioning tree of the embedding, giving O(N log N). Use it
          when N is large enough that the exact algorithm is slow or cannot
          allocate; on this machine the two cost the same at about N = 500 and
          'barneshut' is eight times faster at N = 2000.

          The two do not return the same embedding, and their LOSS values are
          not comparable either: the divergence is summed over the pairs that
          carry an affinity, and 'barneshut' keeps far fewer of them.

     'Theta'
          The tree opening criterion for 'barneshut', a non-negative scalar
          (default 0.5).  A cell of the tree is collapsed to its centre of mass
          when its width is smaller than THETA times its distance from the point
          being pushed, so a larger value is faster and coarser.  0 collapses
          nothing and makes the repulsion exact, at O(N^2); note that this still
          leaves the affinities sparse, so it does not reproduce 'exact'.
          Ignored by 'exact'.

     'Distance'
          The distance metric used for the high-dimensional affinities, as
          accepted by ‘pdist’ (default 'euclidean').

     'NumDimensions'
          The dimension of the embedding Y (default ‘min (P, 2)’).

     'NumPCAComponents'
          If positive, reduce X to this many principal components before
          embedding (default 0, no reduction).

     'Standardize'
          Logical; center and scale each column of X before embedding (default
          false).

     'Perplexity'
          The effective number of local neighbors (default 30).  It must be
          smaller than N.

     'Exaggeration'
          Tightness factor applied to the high-dimensional affinities for the
          first 100 iterations (default 4, no less than 1).

     'LearnRate'
          The learning rate of the optimization (default 500).

     'InitialY'
          An N * NUMDIMENSIONS initial embedding (default ‘1e-4 * randn’).

     'Options'
          A structure (as returned by ‘statset’) whose MaxIter (default 1000)
          and TolFun (default ‘1e-10’) fields control the optimization.

     The embedding is not unique: it depends on the initial configuration and
     the random state.  Set 'InitialY' (or the random seed) for a reproducible
     result.

     See also: pca, pdist, statset.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 52
t-distributed stochastic neighbor embedding (t-SNE).





