fitted-methods: Extract fitted values from PCA.

Description Usage Arguments Details Value Author(s) Examples

Description

Fitted values of a PCA model

Usage

1
2
3
4
5
6
7
## S3 method for class 'pcaRes'
fitted(object, data = NULL, nPcs = nP(object),
  pre = TRUE, post = TRUE, ...)

## S4 method for signature 'pcaRes'
fitted(object, data = NULL, nPcs = nP(object),
  pre = TRUE, post = TRUE, ...)

Arguments

object

the pcaRes object of interest.

data

For standard PCA methods this can safely be left null to get scores x loadings but if set, then the scores are obtained by projecting provided data onto the loadings. If data contains missing values the result will be all NA. Non-linear PCA is an exception, here if data is NULL then data is set to the completeObs and propaged through the network.

nPcs

The number of PC's to consider

pre

pre-process data based on the pre-processing chosen for the PCA model

post

unpre-process the final data (add the center back etc to get the final estimate)

...

Not used

Details

This function extracts the fitted values from a pcaResobject. For PCA methods like SVD, Nipals, PPCA etc this is basically just the scores multipled by the loadings and adjusted for pre-processing. for non-linear PCA the original data is propagated through the network to obtain the approximated data.

Value

A matrix representing the fitted data

Author(s)

Henning Redestig

Examples

1
2
pc <- pca(iris[,1:4], nPcs=4, center=TRUE, scale="uv")
sum( (fitted(pc) - iris[,1:4])^2 )

Example output

Loading required package: Biobase
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, basename, cbind, colMeans, colSums, colnames,
    dirname, do.call, duplicated, eval, evalq, get, grep, grepl,
    intersect, is.unsorted, lapply, lengths, mapply, match, mget,
    order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind,
    rowMeans, rowSums, rownames, sapply, setdiff, sort, table, tapply,
    union, unique, unsplit, which, which.max, which.min

Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.


Attaching package: 'pcaMethods'

The following object is masked from 'package:stats':

    loadings

[1] 1.822492e-28

pcaMethods documentation built on Nov. 8, 2020, 6:19 p.m.