Dimension Reduction - Diagnostic - Quality Table

From Q
Jump to navigation Jump to search

Create a table containing measures of the 'quality' of a correspondence analysis

Computes measures of the quality of a correspondence analysis of a table.

Example

The table below shows that the first 2 dimensions of a correspondence analysis represent most brands very well, with the exception of Diet Coke.

Technical details

The percentages across the top of the table show the proportion of variance explained by each dimension.

The row labels show the quality score for each row and column category. That is, the proportion of variance explained by the first two dimensions for each row and column category.

The cells of the table show breakdown of the quality score by dimension. The first two columns sum to the quality score.

Code

includeWeb("QScript R Output Functions");

main();

function main() {

    // The following 2 variables contain information specific to this diagnostic.
    var required_class = "CorrespondenceAnalysis";
    var output_name_suffix = "quality";
    
    var item = checkSelectedItemClass(required_class);
    if (item == null)
        return false;
    var r_name = stringToRName(item.referenceName);

    // The following lines contain the R code to run
    var expression = "CAQuality(" + r_name + ")"

    return createROutput(item, expression, output_name_suffix);
}