fitted.nmf: Extract fitted values from NMF models

View source: R/s3methods.R

fitted.nmfR Documentation

Extract fitted values from NMF models

Description

Returns the reconstructed matrix \hat{Y} = X B from a fitted NMF model.

For nmf.sem objects, returns the equilibrium prediction \hat{Y}_1 = M_{model} Y_2 if available. Supply Y1 and Y2 to get the direct reconstruction X (C_1 Y_1 + C_2 Y_2) instead.

Usage

## S3 method for class 'nmf'
fitted(object, ...)

## S3 method for class 'nmfae'
fitted(object, ...)

## S3 method for class 'nmfre'
fitted(object, type = c("blup", "fixed"), ...)

## S3 method for class 'nmf.sem'
fitted(object, ...)

Arguments

object

A fitted model object of class "nmf", "nmfkc", "nmfae", "nmfre", or "nmf.sem".

...

For nmf.sem: optionally Y1 and Y2.

type

For nmfre objects: "blup" (default, the fit X(\Theta A + U) including random effects) or "fixed" (X\Theta A, fixed effects only). Chosen so that Y - fitted(object, type) equals residuals(object, Y, type).

Value

The fitted matrix X B.

See Also

nmfkc, nmfae, nmfre, nmf.sem, residuals.nmf

Examples

result <- nmfkc(matrix(runif(50), 5, 10), rank = 2)
fitted(result)


nmfkc documentation built on July 14, 2026, 1:07 a.m.