sim.ProjectiveDecomposition: Scale Independent Matrix

Description Usage Arguments Value Author(s) Examples

Description

Given an (m x n) projective decomposition object and a matrix M of the same size, produces the corresponding scale independent matrix W of the same class as M.

Usage

1
sim(object, M)

Arguments

object

A ProjectiveDecomposition object of size (m x n), i.e. with m row scaling factors and n column scaling factors.

M

Any matrix of size (m x n) inheriting from the class Matrix::Matrix.

Value

Returns a matrix scaled by the magnitude, row-scaling, and column-scaling factors the ProjectiveDecomposition object contains. The intent is to use the projective decomposition of the matrix M to rescale M to W, the scale-independent matrix equivalent to M. This is equivalent to normalizing M for scale on every row and column simultaneously to produce W.

Author(s)

Max Robinson

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
M <- as.matrix(iris[,1:4])
W <- sim(pd(M),M)
Cs <- c('orange','ForestGreen','DodgerBlue')[as.integer(iris[,5])]

xyr <- range(M)
par(mfrow=c(2,2))
plot(M[,1],M[,2],pch=20,
     xlab=colnames(M)[1],xlim=xyr,
     ylab=colnames(M)[2],ylim=xyr,col=Cs)
abline(h=0); abline(v=0)
plot(M[,3],M[,2],pch=20,
     xlab=colnames(M)[3],xlim=xyr,
     ylab=colnames(M)[2],ylim=xyr,col=Cs)
abline(h=0); abline(v=0)
plot(M[,1],M[,4],pch=20,
     xlab=colnames(M)[1],xlim=xyr,
     ylab=colnames(M)[4],ylim=xyr,col=Cs)
abline(h=0); abline(v=0)
plot(M[,3],M[,4],pch=20,
     xlab=colnames(M)[3],xlim=xyr,
     ylab=colnames(M)[4],ylim=xyr,col=Cs)
abline(h=0); abline(v=0)


xyr <- c(-1,1)*2
par(mfrow=c(2,2))
plot(W[,1],W[,2],pch=20,
     xlab=colnames(M)[1],xlim=xyr,
     ylab=colnames(M)[2],ylim=xyr,col=Cs)
abline(h=0); abline(v=0)
plot(W[,3],W[,2],pch=20,
     xlab=colnames(M)[3],xlim=xyr,
     ylab=colnames(M)[2],ylim=xyr,col=Cs)
abline(h=0); abline(v=0)
plot(W[,1],W[,4],pch=20,
     xlab=colnames(M)[1],xlim=xyr,
     ylab=colnames(M)[4],ylim=xyr,col=Cs)
abline(h=0); abline(v=0)
plot(W[,3],W[,4],pch=20,
     xlab=colnames(M)[3],xlim=xyr,
     ylab=colnames(M)[4],ylim=xyr,col=Cs)
abline(h=0); abline(v=0)

## The function is currently defined as
function (object, ..., digits = max(3L, getOption("digits") - 
    3L)) 
{
    m <- length(object$row.factor)
    n <- length(object$col.factor)
    k <- 5
    cat("(", paste(m, "x", n), ")", " scalar ", paste(signif(object$scalar, 
        digits)), " precision ", paste(signif(object$precision, 
        digits)), ", ", paste(object$iterations), "iterations\nrows: ")
    if (m <= k) {
        cat(paste(signif(object$row.factor, digits)))
    }
    else {
        cat(paste(signif(object$row.factor[1:k], digits)))
        cat(" ...")
    }
    cat("\ncols: ")
    if (n <= k) {
        cat(paste(signif(object$col.factor, digits)))
    }
    else {
        cat(paste(signif(object$col.factor[1:k], digits)))
        cat("... ")
    }
  }

maxbox51/ProjDecomp documentation built on May 29, 2019, 4:41 a.m.