Regression - Diagnostic - Plot - Goodness of Fit

From Q
Jump to navigation Jump to search


Produce a scatterplot of target outcomes (x-axis) versus fitted values (y-axis)

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

form.setHeading("Goodness of Fit");
form.dropBox({name: "inputItem", 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(QInputs(inputItem), max.points = formMaxPoints)