Regression - Diagnostic - StandardRPlot - Goodness of Fit

From Q
Jump to navigation Jump to search


VizIcon Regression Diagnostic.svg

Produces a scatterplot of target outcomes (x-axis) versus fitted values (y-axis). The Spearman's rank correlation coefficient is shown. A high correlation indicates that fitted values are ranked in a similar order to target outcomes. Points should be randomly scattered around a 45 degree line through the origin.

Example

Options

Regression An R Output containing a regression analysis.

Maximum points The maximum number of points to plot. If the object contains more data points, a random sample is taken.

Code

var heading_text = "Goodness of Fit";
if (!!form.setObjectInspectorTitle)
    form.setObjectInspectorTitle(heading_text);
else 
    form.setHeading(heading_text);

form.dropBox({name: "formInput", label: "Regression:", types: ["RItem:Regression"],
              prompt: "Select a Regression output to plot fitted values for" });
form.numericUpDown({name: "formMaxPoints", label: "Maximum points", default_value: 1000, 
                    increment: 1, minimum: 2, maximum: Number.MAX_SAFE_INTEGER, prompt: "The maximum number of observations to plot" });
library(flipRegression)
goodness.of.fit <- GoodnessOfFitPlot(formInput, max.points = formMaxPoints)