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

    Function qrFitted

    • Least-squares fitted values for a vector response: the projection of y onto the space spanned by the first k pivoted columns. Equivalent to R's qr.fitted().

      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.

      • Optionaloptions: { k?: number }

        k: the number of pivoted columns to project onto (an integer from 0 to rank). Default: q.rank.

      Returns number[]

      The fitted values as a vector.

      const q = qr([[1, 1], [1, 2], [1, 3], [1, 4]]);
      qrFitted(q, [2.1, 3.9, 6.2, 7.8]); // [2.09, 4.03, 5.97, 7.91]
    • Least-squares fitted values 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.

      • Optionaloptions: { k?: number }

        k: the number of pivoted columns to project onto (an integer from 0 to rank). Default: q.rank.

      Returns number[][]

      The fitted values as an array of rows.

    • Least-squares fitted values.

      Parameters

      • q: QR

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

      • y: VectorOrMatrix

        The response, a vector or a matrix.

      • Optionaloptions: { k?: number }

        k: the number of pivoted columns to project onto (an integer from 0 to rank). Default: q.rank.

      Returns number[] | number[][]

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