Learn R Programming

albatross (version 0.1-1)

fitted.feemparafac: Extract fitted PARAFAC values or residuals

Description

fitted calculates an approximation of a FEEM cube fitted by PARAFAC.

residuals returns the difference between fitted and the original data as a FEEM cube.

Usage

# S3 method for feemparafac
fitted(object, ...)
  # S3 method for feemparafac
residuals(object, ...)

Arguments

object

An object returned by feemparafac.

No arguments besides those described above are allowed.

Value

A FEEM cube object.

Details

The output of fitted.parafac from multiway package is rescaled back according to saved scales (typically those from feemscale, e.g. sd norms of each spectrum) from the original cube in order to be comparable with it.

The output of residuals is \(\mathbf{X} - \hat{\mathbf{X}}\).

See Also

feemcube, fitted.parafac, resid.

Examples

Run this code
# NOT RUN {
  data(feems)
  cube <- feemscale(
    feemscatter(
      feemcube(feems, FALSE)[1:36*5, 1:11*5,],
      rep(24, 4)), na.rm = TRUE
  )
  factors <- feemparafac(cube, nfac = 2, const = rep('nonneg', 3))
  # calls plot.feemcube for estimated spectra
  plot(fitted(factors))
  plot(resid(factors))
# }

Run the code above in your browser using DataLab