|
| 1 | +# Confidence Interval Plot |
| 2 | + |
| 3 | +Version: 1.0 |
| 4 | + |
| 5 | +This chart creates a mean line within a shaded confidence interval area. |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | +## Syntax |
| 10 | +* `confidenceIntervalPlot(x,y)` create a line which passes through the means of the y-values for each unique x-value. Plot this line within a shaded area covering a 95% confidence interval for each unique x-value. x and y must be numeric vectors of equal length. |
| 11 | +* `confidenceIntervalPlot(x,y,alpha)` create a line which passes through the means of the y-values for each unique x-value. Plot this line within a shaded area covering a 100 * (1 - alpha)% confidence interval for each unique x-value. x and y must be numeric vectors of equal length. |
| 12 | +* `confidenceIntervalPlot()` create an empty confidence interval plot. |
| 13 | +* `confidenceIntervalPlot(___,Name,Value)` specifies additional options for the confidence interval plot using one or more name-value pair arguments. Specify the options after all other input arguments. |
| 14 | +* `confidenceIntervalPlot(parent,___)` creates the confidence interval plot in the specified parent. |
| 15 | +* `h = confidenceIntervalPlot(___)` returns the confidenceIntervalPlot object. Use h to modify properties of the plot after creating it. |
| 16 | + |
| 17 | +## Name-Value Pair Arguments/Properties |
| 18 | +* `XData` (1 x n numeric vector) x-values of the raw data. |
| 19 | +* `YData` (1 x n numeric vector) y-values of the raw data. |
| 20 | +* `CenterXData` (1 x n numeric vector) read-only property. x-values used to plot the center line. Unless the name/value pair `'edges'` is used, contains unique x-values in XData. |
| 21 | +* `CenterYData` (1 x n numeric vector) y-values used to plot the center line. Unless the name/value pair `'edges'` is used or CenterYData is manually specified by the user, contains the mean of y-values for each unique x-value in XData. |
| 22 | +* `CenterYDataMode` (`'auto'` or '`manual'`) mode describing the method by which the center line is determined. In `'auto'` mode, the mean of the y-values for each center line x-value used. In `'manual'` mode, the user can specify CenterYData as Name/Value pair. |
| 23 | +* `Alpha` (scalar double) confidence level (denoted alpha) for the confidence interval about the mean line. Has lower precedence than UpperBoundData and LowerBoundData if specified. |
| 24 | +* `UpperBoundData` (1 x n numeric vector) upper bound data of the shaded area encapsulating the mean line. By default is set to MeanData + StdDevData unless otherwise specified. |
| 25 | +* `LowerBoundData` (1 x n numeric vector) The lower bound data of the shaded area encapsulating the mean line. By default is set to MeanData - StdDevData unless otherwise specified. |
| 26 | +* `BoundDataMode` (`'auto'` or '`manual'`) mode describing the method by which the bounds of the shaded area are determined. In `'auto'` mode, a confidence interval of level alpha (default `0.05`) will be used. In `'manual'` mode, the user can specify UpperBoundData and LowerBoundData as Name/Value pairs. |
| 27 | +* `Edges` (1 x n numeric vector) edges of the bins used to group raw x-data values and generate the center line x-data and y-data. Once grouped, the mean x-value of each bin (excluding NaNs) will be used for CenterXData and the mean y-value of each bin (excluding NaNs) will be used for CenterYData. |
| 28 | + |
| 29 | +## Stylistic Name-Value Pair Arguments/Properties |
| 30 | +* `TitleText` (1 x n char vector) title of the confidence interval plot. |
| 31 | +* `SubtitleText` n x 1 char vector) subtitle of the confidence interval plot. |
| 32 | +* `ShadeColor` (1 x 3 numeric vector) color of the shaded area surrounding the mean line. |
| 33 | +* `ShadeAlpha` (scalar double) transparency (alpha) of the shaded area surrounding the line. |
| 34 | +* `CenterLineColor` (1 x 3 numeric vector) color of the center line contained in the shaded area. |
| 35 | +* `CenterLineWidth` (scalar double) width of the center line. |
| 36 | +* `BorderLinesColor` (1 x 3 numeric vector) color of the two lines outlining the shaded area from above and below. |
| 37 | +* `BorderLinesWidth` (scalar double) width of the two lines outlining the shaded area about the center line. |
| 38 | +* `ShowRawData` (scalar `matlab.lang.OnOffSwitchState`) OnOffSwitchState object indicating whether to plot the original data (XData, YData) as scatter points. |
| 39 | +* `RawDataMarker` (char) marker symbol for raw data if ShowRawData is true. |
| 40 | +* `RawDataMarkerColor` (1 x 3 numeric vector) color of data markers for raw data if ShowRawData is true. |
| 41 | +* `RawDataMarkerSize` (double) size of data markers for raw data if ShowRawData is true. |
| 42 | +* `ShowCenterData` (scalar `matlab.lang.OnOffSwitchState`) OnOffSwitchState object indicating whether to plot the original data (CenterXData, CenterYData) as scatter points. |
| 43 | +* `CenterDataMarker` (char) marker symbol for raw data if ShowCenterData is true. |
| 44 | +* `CenterDataMarkerColor` (1 x 3 numeric vector) color of data markers for raw data if ShowCenterData is true. |
| 45 | +* `CenterDataMarkerSize` (double) size of data markers for raw data if ShowCenterData is true. |
| 46 | + |
| 47 | +## Example |
| 48 | +Create a confidence interval plot for sine data with noise. Each unique x-value is associated with three y-values. By default, the confidence interval is a 95% confidence interval for each unique x-value. |
| 49 | +``` |
| 50 | +uniqueX = -2 * pi : pi/4 : 2*pi; |
| 51 | +
|
| 52 | +x = repelem(uniqueX, 3); |
| 53 | +y = sin(x) + 0.5 * rand(size(x)); |
| 54 | + |
| 55 | +cip = confidenceIntervalPlot(x,y); |
| 56 | +cip.NumSteps = 10; |
| 57 | +
|
| 58 | +title("95% Confidence Interval Plot, Sine Curve with Random Noise"); |
| 59 | +subtitle("Alpha = 0.05"); |
| 60 | +``` |
0 commit comments