Machine Learning - Diagnostic - Discriminant Functions

From Q
Jump to: navigation, search

Produces a table of coefficients of linear discriminant functions for each class of a Linear Discriminant Analysis. The class of a new data point can be predicted by computing the functions for all classes and choosing the class with the highest function output.

Example

Code

includeWeb("QScript R Output Functions");

main();

function main() {

    // The following 2 variables contain information specific to this diagnostic.
    var required_class = "LDA";
    var output_name_suffix = "discriminant.functions";
    
    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 = r_name + "$original$discriminant.functions";

    return createROutput(item, expression, output_name_suffix);
}