svd3dplot: The SVD three dimensional plots: surface plot and/or image...

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/svd3dplot.R

Description

This function provides surface or image plot for singular value decomposition method. The plot includes several subplots for the following components: original data, cumulative approximation matrix, residual matrix, and several rank 1 SVD components.

Usage

1
2
svd3dplot(data, ncomp = 3, irow=F, icol=F, isurface = T, iimage = F, 
      xlab = "Column", ylab = "Row", zlab = "", ...)

Arguments

data

The input data matrix

ncomp

The number of components to calculate. The default value is 3. If the specified number is larger than the rank of the matrix, this option will automatically be set to the rank of the matrix minus one. When either irow and icol is specified as TRUE, the output will include a mean matrix, and ncomp-1 SVD component of the demeaned matrix.

irow

a logical number. If irow and icol both are TRUE, this program will calculate a doublemean. The resulting SVD will be based on the demeaned matrix (i.e., removing the double mean). If only irow is TRUE, this program will calculate a rowmean, and the resulting SVD will be based on the corresponding demeaned matrix (i.e., removing the row mean).

icol

a logical number. If irow and icol both are TRUE, this program will calculate a doublemean. The resulting SVD will be based on the demeaned matrix (i.e., removing the double mean). If only icol is TRUE, this program will calculate a columnmean, and the resulting SVD will be based on the corresponding demeaned matrix (i.e., removing the column mean).

isurface

Whether the surface plot will be generated. The default value is TRUE.

iimage

Whether the image plot will be generated. The default value is FALSE.

xlab

The xlab option for the plots. The default value is Column.

ylab

The ylab option for the plots. The default value is Row.

zlab

The zlab option for the plots. The default value is empty.

...

other related ploting options for wireframe or levelplot in the trellis plot.

Value

The code will generate either a surface plot or an image plot for the individual SVD components, the original data, the approximation data and the residual data.

Author(s)

Lingsong Zhang (lingsong@purdue.edu)

References

See detailed explanation of this visualizaiton in \ Zhang, L., Marron, J. S., Shen, H. and Zhu, Z. (2007), Singular Value Decomposition and Its Visualization, Journal of Computational and Graphical Statistics.

See Also

See Also as svd, wireframe, and levelplot.

Examples

1
2
3
4
5
6
7
8
9
#generate a random sample
#generate a random matrix
x<-matrix(rnorm(100), nrow=20);

#generate a surface plot
svd3dplot(x);

#generate an image plot
svd3dplot(x, iimage=TRUE);

Example output

Loading required package: lattice
[1] "Can not simultaneously generate image plots and surface plots"
[1] "Will only show the image plot"

svdvisual documentation built on May 2, 2019, 4:15 a.m.