r - Principal Component Rotation matrix with different dimension -
i not able understand why happening. have data matrix (64x6830). when following
pr.out=prcomp(data,scale=true) dim(pr.out$rotation) # [1] 6830 64 i not able understand why rotation matrix not 6830x6830. when take subset of data this:
data1=data[1:nrow(data),1:10] pr.data=prcomp(data1,scale=true) dim(pr.data$rotation) # [1] 10 10 so smaller size same data giving correct, clueless why giving different rotation matrix when done on whole dataset.
the function prcomp based on function svd:
svd(x, nu = min(n, p), nv = min(n, p), linpack = false) from edit(stats:::prcomp.default), see:
s <- svd(x, nu = 0) this means left singular vectors not computed. thus, in case of prcomp, svd returns "a vector containing singular values of x, of length min(n, p)" , "a matrix columns contain right singular vectors of x [...]. dimension c(p, nv)"
if go call of svd, nv defined nv = min(n, p) (minimum between n , p), n = row(x) , p = ncol(x).
- in case of "data",
n = 64,p = 6830.nv = 64,pr.out$rotation6830x64 (p x nv) matrix - in case of "data1",
n = 10,p = 10.nv = 10, andpr.out$rotation10x10 (p x nv) matrix
Comments
Post a Comment