rStats.js v1.3.0
    Preparing search index...

    Function qrResid

    • Least-squares residuals for a vector response: y minus its projection onto the space spanned by the first rank pivoted columns. Equivalent to R's qr.resid().

      Not supported for a decomposition computed with lapack: true (throws).

      Parameters

      • q: QR

        A QR decomposition from qr.

      • y: readonly number[] | Float64Array<ArrayBufferLike>

        The response vector, with as many elements as the decomposed matrix has rows.

      Returns number[]

      The residual vector.

      const q = qr([[1, 1], [1, 2], [1, 3], [1, 4]]);
      qrResid(q, [2.1, 3.9, 6.2, 7.8]); // [0.01, -0.13, 0.23, -0.11]
    • Least-squares residuals for each column of a matrix response.

      Parameters

      • q: QR

        A QR decomposition from qr (not lapack: true).

      • y: MatrixInput

        The response matrix (array of rows), with as many rows as the decomposed matrix.

      Returns number[][]

      The residuals as an array of rows.

    • Least-squares residuals.

      Parameters

      • q: QR

        A QR decomposition from qr (not lapack: true).

      • y: VectorOrMatrix

        The response, a vector or a matrix.

      Returns number[] | number[][]

      A vector if y is a vector, otherwise an array of rows.