printca: Print full results

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

View source: R/defineclassesandfunctions.R

Description

Prints full results from Correspondence Analysis, including variances, but no plots.

Usage

1
printca(x, datasetname = "")

Arguments

x

object of class cabootcrsresults.

datasetname

name of data set, to appear in output.

Details

Prints the usual Correspondence Analysis output plus the variances and covariances calculated by cabootcrs.

Firstly, the principal inertias for all dimensions.

Secondly, for the number of dimensions specified in the printdims slot, defined by the original call to cabootcrs:

Principal coordinates for row points
Contributions (per mil) for row points
Representations a.k.a. correlations (per mil) for row points
Principal coordinates for column points
Contributions (per mil) for column points
Representations a.k.a. correlations (per mil) for column points

Thirdly, for the number of dimensions defined by the axisvariances slot, which was defined by the lastaxis parameter in the original call to cabootcrs:

Estimated variances and covariances for row points.
Estimated variances and covariances for column points.

Value

Printed output.

Author(s)

T.J. Ringrose

See Also

plotca , summaryca , cabootcrsresults

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
dreamdata <- t(matrix(c(7,4,3,7,10,15,11,13,23,9,11,7,28,9,12,10,32,5,4,3),4,5))
bd <- cabootcrs(dreamdata)
printca(bd, datasetname="Dreams")


## The function is currently defined as
function (x, datasetname = "") 
{
    printwithaxes <- function(res, thenames) {
        names(res) <- thenames
        print(res, digits = 4)
    }
    d <- min(x@printdims, x@br@r)
    axnames <- character(length = d)
    for (i in 1:d) {
        axnames[i] <- paste(" Axis", i)
    }
    cat("\n    RESULTS for Correspondence Analysis:", datasetname, 
        "\n\n")
    cat("Total inertia ", x@inertiasum, "\n\n")
    cat("Inertias, percent inertias and cumulative percent inertias \n\n")
    ins <- data.frame(x@inertias)
    names(ins) <- c("Inertia", "%  ", "Cum. %")
    print(ins, digits = 6)
    cat("\nRows in principal coordinates\n\n")
    printwithaxes(data.frame(x@Rowprinccoord[, 1:d], row.names = x@rowlabels), 
        axnames)
    cat("\nRow contributions (per mil)\n\n")
    printwithaxes(data.frame(round(x@RowCTR[, 1:d] * 1000), row.names = x@rowlabels), 
        axnames)
    cat("\nRow representations (per mil)\n\n")
    printwithaxes(data.frame(round(x@RowREP[, 1:d] * 1000), row.names = x@rowlabels), 
        axnames)
    cat("\nColumns in principal coordinates\n\n")
    printwithaxes(data.frame(x@Colprinccoord[, 1:d], row.names = x@collabels), 
        axnames)
    cat("\nColumn contributions (per mil)\n\n")
    printwithaxes(data.frame(round(x@ColCTR[, 1:d] * 1000), row.names = x@collabels), 
        axnames)
    cat("\nColumn representations (per mil)\n\n")
    printwithaxes(data.frame(round(x@ColREP[, 1:d] * 1000), row.names = x@collabels), 
        axnames)
    if (x@nboots > 0) {
        cat("\n\n  Results for Bootstrapping\n\n")
        cat(x@nboots, "bootstrap replications with", x@resampledistn, 
            "resampling\n")
        if (x@resampledistn == "multinomial" & x@multinomialtype != 
            "whole") 
            cat(paste("  ", switch(x@multinomialtype, rowsfixed = "with row sums constant", 
                columnsfixed = "with column sums constant"), 
                "\n"))
        cat("\nEstimated variances and covariances\n\n")
        cat("Rows\n\n")
        print(allvarscovs(x, "rows"), digits = 4)
        cat("\nColumns\n\n")
        print(allvarscovs(x, "columns"), digits = 4)
        cat("\n\n")
    }
  }

cabootcrs documentation built on May 30, 2017, 8:18 a.m.