SSJ  3.3.1
Stochastic Simulation in Java
Public Member Functions | List of all members
QQPlot Class Reference

This class implements QQ-plot (or quantile-quantile plot) objects that compare two probability distributions. More...

Inheritance diagram for QQPlot:
[legend]
Collaboration diagram for QQPlot:
[legend]

Public Member Functions

 QQPlot (String title, String XLabel, String YLabel, ContinuousDistribution dist, double[] X)
 Constructs a new QQPlot instance using the points X. More...
 
 QQPlot (String title, String XLabel, String YLabel, ContinuousDistribution dist, double[] X, int numPoints)
 Similar to the constructor QQPlot(title, XLabel, YLabel, dist, X) above, except that only the first numPoints of X are plotted. More...
 
 QQPlot (String title, String XLabel, String YLabel, ContinuousDistribution dist, double[][] data, int r)
 Constructs a new QQPlot instance. More...
 
- Public Member Functions inherited from XYLineChart
 XYLineChart ()
 Initializes a new XYLineChart instance with an empty data set.
 
 XYLineChart (String title, String XLabel, String YLabel, double[][]... data)
 Initializes a new XYLineChart instance with sets of points data. More...
 
 XYLineChart (String title, String XLabel, String YLabel, double[][] data, int numPoints)
 Initializes a new XYLineChart instance with sets of points data. More...
 
 XYLineChart (String title, String XLabel, String YLabel, double[][] data, int x, int y)
 Initializes a new XYLineChart instance using subsets of data. More...
 
 XYLineChart (String title, String XLabel, String YLabel, DoubleArrayList... data)
 Initializes a new XYLineChart instance with data data. More...
 
 XYLineChart (String title, String XLabel, String YLabel, XYSeriesCollection data)
 Initializes a new XYLineChart instance with data data. More...
 
int add (double[] x, double[] y, String name, String plotStyle)
 Adds a data series into the series collection. More...
 
int add (double[] x, double[] y)
 Adds a data series into the series collection. More...
 
int add (double[] x, double[] y, int numPoints)
 Adds a data series into the series collection. More...
 
int add (double[][] data)
 Adds the new collection of data series data into the series collection. More...
 
int add (double[][] data, int numPoints)
 Adds the new collection of data series data into the series collection. More...
 
XYListSeriesCollection getSeriesCollection ()
 Returns the chart’s dataset. More...
 
void setSeriesCollection (XYListSeriesCollection dataset)
 Links a new dataset to the current chart. More...
 
void setTicksSynchro (int s)
 Synchronizes \(X\)-axis ticks to the \(s\)-th series \(x\)-values. More...
 
JFrame view (int width, int height)
 Displays chart on the screen using Swing. More...
 
JFrame viewBar (int width, int height)
 Displays bar chart on the screen using Swing. More...
 
String toLatex (double width, double height)
 
- Public Member Functions inherited from XYChart
JFreeChart getJFreeChart ()
 Returns the JFreeChart object associated with this chart. More...
 
Axis getXAxis ()
 Returns the chart’s domain axis ( \(x\)-axis) object. More...
 
Axis getYAxis ()
 Returns the chart’s range axis ( \(y\)-axis) object. More...
 
abstract JFrame view (int width, int height)
 Displays chart on the screen using Swing.
 
String getTitle ()
 Gets the current chart title. More...
 
void setTitle (String title)
 Sets a title to this chart. More...
 
void setprobFlag (boolean flag)
 Must be set true when plotting probabilities, false otherwise. More...
 
void setAutoRange ()
 The \(x\) and the \(y\) ranges of the chart are set automatically.
 
void setAutoRange (boolean right, boolean top)
 The \(x\) and the \(y\) ranges of the chart are set automatically. More...
 
void setAutoRange00 (boolean xZero, boolean yZero)
 The \(x\) and the \(y\) ranges of the chart are set automatically. More...
 
void setManualRange (double[] range)
 Sets the \(x\) and \(y\) ranges of the chart using the format: range = [xmin, xmax, ymin, ymax]. More...
 
void setManualRange (double[] range, boolean right, boolean top)
 Sets the \(x\) and \(y\) ranges of the chart using the format: range = [xmin, xmax, ymin, ymax]. More...
 
void setManualRange00 (double[] range, boolean xZero, boolean yZero)
 Sets the \(x\) and \(y\) ranges of the chart using the format: range = [xmin, xmax, ymin, ymax]. More...
 
double getChartMargin ()
 Returns the chart margin, which is the fraction by which the chart is enlarged on its borders. More...
 
void setChartMargin (double margin)
 Sets the chart margin to margin. More...
 
abstract void setTicksSynchro (int s)
 Synchronizes \(x\)-axis ticks to the \(s\)-th series \(x\)-values. More...
 
void drawVerticalLine (double x, String name, double yfrac, boolean right)
 Draws a vertical line on the chart at \(x\)-coordinate x. More...
 
void enableGrid (double xstep, double ystep)
 Puts a grid on the background. More...
 
void disableGrid ()
 Disables the background grid.
 
abstract String toLatex (double width, double height)
 Exports the chart to a LaTeX source code using PGF/TikZ. More...
 
void toLatexFile (String fileName, double width, double height)
 Transforms the chart to LaTeX form and writes it in file fileName. More...
 
void setLatexDocFlag (boolean flag)
 Flag to remove the \documentclass (and other) commands in the created LaTeX files. More...
 

Additional Inherited Members

- Protected Member Functions inherited from XYLineChart
void init (String title, String XLabel, String YLabel)
 
void initAxis ()
 
- Protected Member Functions inherited from XYChart
void setAutoRange (boolean xZero, boolean yZero, boolean right, boolean top)
 
void setTick0Flags ()
 
double computeXScale (double position)
 
double computeYScale (double position)
 
double computeScale (double[] bounds)
 
- Protected Attributes inherited from XYChart
Axis XAxis
 
Axis YAxis
 
SSJXYSeriesCollection dataset
 
JFreeChart chart
 
boolean latexDocFlag = true
 
boolean autoRange
 
double [] manualRange
 
boolean grid = false
 
double xstepGrid
 
double ystepGrid
 
boolean probFlag = false
 
double chartMargin = 0.02
 

Detailed Description

This class implements QQ-plot (or quantile-quantile plot) objects that compare two probability distributions.

The data is given as a list of \(x\)-coordinates \((x_1, x_2, …, x_n)\), and one is given a reference continuous probability distribution \(F(x)\). One first sorts the \(x_i\) in ascending order, then noted \(x_{(i)}\), and plots the points \((F^{-1}(p_i), x_{(i)})\), where \(i= 1, 2, …, n\) and \(p_i = (i- 1/2)/n\), to see if the data \(x_i\) comes from the reference distribution \(F(x)\). The graph of the straight line \(y=x\) is also plotted for comparison.

Constructor & Destructor Documentation

◆ QQPlot() [1/3]

QQPlot ( String  title,
String  XLabel,
String  YLabel,
ContinuousDistribution  dist,
double []  X 
)

Constructs a new QQPlot instance using the points X.

title is a title, XLabel is a short description of the \(x\)-axis, and YLabel a short description of the \(y\)-axis. The plot is a QQ-plot of the points \((F^{-1}(p_i), x_{(i)})\), \(i= 1, 2, …, n\), where \(p_i = (i- 1/2)/n\), \(x_i = \) X[ \(i\)-1], \(x_{(i)}\) are the sorted points, and \(x = F^{-1}(p) = \) dist.inverseF( \(p\)). The points X are not sorted.

Parameters
titlechart title.
XLabelLabel on \(x\)-axis.
YLabelLabel on \(y\)-axis.
distReference distribution
Xpoints.

◆ QQPlot() [2/3]

QQPlot ( String  title,
String  XLabel,
String  YLabel,
ContinuousDistribution  dist,
double []  X,
int  numPoints 
)

Similar to the constructor QQPlot(title, XLabel, YLabel, dist, X) above, except that only the first numPoints of X are plotted.

Parameters
titlechart title.
XLabelLabel on \(x\)-axis.
YLabelLabel on \(y\)-axis.
distReference distribution
Xpoint set.
numPointsnumber of points to plot

◆ QQPlot() [3/3]

QQPlot ( String  title,
String  XLabel,
String  YLabel,
ContinuousDistribution  dist,
double  data[][],
int  r 
)

Constructs a new QQPlot instance.

title is a title, XLabel is a short description of the \(x\)-axis, and YLabel a short description of the \(y\)-axis. The input vectors in data represents several sets of \(x\)-points. \(r\) determine the set of points to be plotted in the QQ-plot, that is, one will plot only the points data[r][i], for \(i=0, 1, …, (n-1)\) and a given \(r\), where \(n\) is the number of points in set \(r\). The points are assumed to follow the distribution dist.

Parameters
titlechart title.
XLabelLabel on \(x\)-axis.
YLabelLabel on \(y\)-axis.
distReference distribution
dataseries of point sets.
rset of points to plot

The documentation for this class was generated from the following file: