Regression - mwasiluk/ODC-d3 GitHub Wiki

Scatterplot with regression lines and confidence intervals. Extends ScatterPlot

#Demo Online demo

Sample usage

Scatterplot with regression lines and confidence intervals is created with an ODCD3.Regression function:


var placeholderSelector = "#plot";
var data = [ ... ]; // array of arrays/objects 
var config = { //optional config object
    ...
};

var plot = new ODCD3.Regression(placeholderSelector, data, config);  

#Configuration

The ODCD3.Regression function extends ODCD3.ScatterPlot and takes 3 parameters:

  1. selector for plot placeholder element
  2. data to plot
  3. optional config object

Configuration object properties added to base ScatterPlot configuration:

  • mainRegression - show regression for all data, boolean (default: true)
  • groupRegression - show regression for available groups, boolean (default: true)
  • confidence - object containing confidence area configuration:
    • level - confidence level, default: 0.95
    • criticalValue - function used to compute critical value, may be used to override default function:
      
       (degreesOfFreedom, criticalProbability) => StatisticsUtils.tValue(degreesOfFreedom, criticalProbability)