cdsplot

cdsplot produces the candlestick plot for robust model selection in linear regression

Syntax

Description

example

cdsplot(outms) cdsplot with all default options.

example

cdsplot(outms, Name, Value) Interactive_example cdsplot with optional arguments.

Examples

expand all

  • cdsplot with all default options.
  • Load Ozone data (reduced data)

    X=load('ozone.txt');
    % Tranform the response using logs
    X(:,end)=log(X(:,end));
    % Add a time trend
    X=[(-40:39)' X];
    % Define y
    y=X(:,end);
    % Define X
    X=X(:,1:end-1);
    labels={'Time','1','2','3','4','5','6','7','8'};
    % Robust model selection using Cp
    [Cpms]=FSRms(y,X,'labels',labels);
    % Candlestick plot
    cdsplot(Cpms);

  • Interactive example 1. cdsplot with optional arguments.
  • Load Ozone data (full data)

    X=load('ozone_330_obs.txt');
    y=log(X(:,9));
    Time1=[(1:165)';(165:-1:1)'];
    X=[Time1 X(:,1:8)];
    labels={'Time','1','2','3','4','5','6','7','8'};
    outms=FSRms(y,X,'labels',labels,'smallpint',5:6);
    cdsplot(outms,'cpbrush',1,'laboutl',1);

    Input Arguments

    expand all

    outms — plot data. Structure.

    Structure containing the following fields

    Value Description
    stor

    k x 9 matrix containing statistics which are used to create the candles.

    1st col: max Cp values;

    2nd col: min Cp values;

    3rd col: averages Cp values;

    4nd col: median Cp values;

    5th col: x coordinates (or size of submodel);

    6th col: number of explanatory variables of the submodel;

    7th col: y coordinate of final Cp;

    8th col: units entering the final step of the search;

    9th col: maximum Cp value during the search (This is information is used to print the labels on top of each model).

    outl

    r x 4 matrix containing information about 'influential units' or empty matrix.

    Influential units in this context are defined as the units which enter the subset in the final part of the search and bring the value of the Cp below the minimum or above the maximum value of the central part of the search.

    1st col: x coordinates;

    2nd col: y coordinates;

    3rd col: step of entry into subset;

    4nd col: unit number.

    If matrix outl contains more columns they are ignored.

    siz

    vector of length 2 containing information about n (number of units of the sample and bigP, number of explanatory variables, including the constant, in the full model). This information is necessary to compute the envelopes.

    Data Types: struct

    Name-Value Pair Arguments

    Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

    Example: 'color',[0.1 0.2 0.5] , 'LineWidth',0.3 , 'ylimy',[0 100] , 'xlimx',[0 100] , 'label',{'a' 'b' 'c'} , 'quant',[0.01 0.025 0.975 0.99] , 'lablast',0 , 'laboutl',1 , 'labbold',{'a' 'b'} , 'labenv',1 , 'barend',1 , 'cpbrush','' , 'CandleWidth',0.1

    color —Color.vector.

    Three elements color vector, [R G B], or a string specifying the color name. MATLAB supplies a default color if none is specified or if it is empty. The default color differs depending on the background color of the figure window. See COLORSPEC in the MATLAB Reference Guide for color names.

    Example: 'color',[0.1 0.2 0.5]

    Data Types: double

    LineWidth —Line Width.scalar.

    Line Width (in points) for the vertical lines outside the boxes of the candles. The default LineWidth is 0.5 points.

    Example: 'LineWidth',0.3

    Data Types: double

    ylimy —y axis scale.vector.

    Vector with two elements controlling minimum and maximum on the y axis.

    Default value is [-2 50] (automatic scale).

    Example: 'ylimy',[0 100]

    Data Types: double

    xlimx —x axis scale.vector.

    Vector with two elements controlling minimum and maximum on the x axis.

    Default value is '' (automatic scale).

    Example: 'xlimx',[0 100]

    Data Types: double

    label —Labels of the selected models.cell array of strings.

    Cell array of strings of length k (number of rows of matrix stat) containing the labels of the selected models. Default value is '' that is no label is plotted on the screen.

    Example: 'label',{'a' 'b' 'c'}

    Data Types: char

    quant —Quantiles.vector.

    Vector containing quantiles for the horizontal lines associated witht the confidence bands of Cp.

    The default is to plot 2.5% and 97.5% envelopes. In other words the default is quant=[0.025;0.975].

    Example: 'quant',[0.01 0.025 0.975 0.99]

    Data Types: double

    lablast —Label for the last unit entered.scalar.

    Scalar which specifies whether to add the label of the unit which enters the final step of the search close to its symbol. If lablast=1 label is added else (default) no label is added.

    Example: 'lablast',0

    Data Types: double

    laboutl —Label for the influential units.scalar.

    Scalar which specifies whether to add the labels of the 'influential units' if laboutl=1 the unit number is added close to its symbol. if laboutl=2 the unit number together with the entry step is added close to its symbol else (default) no label is added.

    Example: 'laboutl',1

    Data Types: double

    labbold —Models to highliht.cell array of strings.

    Cell array of strings which specifies the models which have to be highlighted (the linewidth of the vertical lines outside the boxes of the models specified in labbold is considerably increased). As default labbold=''.

    Example: 'labbold',{'a' 'b'}

    Data Types: char

    labenv —Quantiles labels.scalar.

    If labelv=1 labels of the quantiles used to generate the horizontal lines associated with the envelopes are added, else if labelv=0 (default) no label is added.

    Example: 'labenv',1

    Data Types: double

    barend —Adding horizontal lines.scalar.

    Scalar which specifies whether to add small horizontal lines at the end of the vertical lines representing the whiskers. If barend=1 horizontal lines are added else (default) no additional line is drawn.

    Example: 'barend',1

    Data Types: double

    cpbrush —Brushing.empty value | matrix.

    If cpbrush is an empty value (default), no brushing is done.

    The activation of this option (cpbrush is a scalar) enables the user to select a set of candles in the candlestick plot and to monitor the corresponding forward searches in a new plot.

    If cpbrush is not an empty value the user has to supply the matrix which in the first column contains the fwd search index and in the other k columns the values of Cp associated with the k models displayed in the candlestick plot.

    Example: 'cpbrush',''

    Data Types: double

    CandleWidth —width.scalar.

    Scalar defining the width of the selection area in cpbrush.

    The default width is 0.05.

    Example: 'CandleWidth',0.1

    Data Types: double

    Output Arguments

    References

    Riani M. and Atkinson A.C. (2010), Robust Model Selection with Flexible Trimming, "Computational Statistics and Data Analysis", Vol. 54, p. 3300-3312.

    See Also

    This page has been automatically generated by our routine publishFS