mdrrsplot

mdrrsplot plots the trajectory of minimum deletion residual from random starts

Syntax

  • brushedUnits=mdrrsplot(out)example
  • brushedUnits=mdrrsplot(out,Name,Value)example
  • [brushedUnits,BrushedUnits]=mdrrsplot(___)example

Description

example

brushedUnits =mdrrsplot(out) Example of the use of function mdrrsplot with all the default options.

example

brushedUnits =mdrrsplot(out, Name, Value) Example of the use of function mdrrsplot with personalized envelopes.

example

[brushedUnits, BrushedUnits] =mdrrsplot(___) Example of option datatooltip.

Examples

expand all

  • Example of the use of function mdrrsplot with all the default options.
  • % The X data have been introduced by Gordaliza, Garcia-Escudero & Mayo-Iscar (2013).
    % The dataset presents two parallel components without contamination.
    X  = load('X.txt');
    y = X(:,end);
    X =X(:,1:end-1);
    [out]=FSRmdrrs(y,X,'bsbsteps',0,'nsimul',300);
    mdrrsplot(out);
    title('ColorTrj = 1 (default)','FontSize',16,'Interpreter','Latex');
    % now with trajectories with colormap
    mdrrsplot(out,'ColorTrj',0,'tag','ColorTrj_0');
    title('ColorTrj = 0 -- color gradient proportional to sum of mdr','FontSize',16,'Interpreter','Latex');
    % now with 2 trajectories with marker symbols
    mdrrsplot(out,'ColorTrj',2,'tag','ColorTrj_2');
    title('ColorTrj = 2 -- highlight the 2 trj with max mdr','FontSize',16,'Interpreter','Latex');
    % now with trajectories with marker symbols
    mdrrsplot(out,'ColorTrj',3,'tag','ColorTrj_3');
    title('ColorTrj = 3 -- highlight the 3 trj with max mdr','FontSize',16,'Interpreter','Latex');
    cascade;
    Click here for the graphical output of this example (link to Ro.S.A. website).

  • Example of the use of function mdrrsplot with personalized envelopes.
  • tclustreg of contaminated X data using all default options.

    % The X data have been introduced by Gordaliza, Garcia-Escudero & Mayo-Iscar (2013).
    % The dataset presents two parallel components without contamination.
    X  = load('X.txt');
    y = X(:,end);
    X =X(:,1:end-1);
    [out]=FSRmdrrs(y,X,'bsbsteps',0);
    mdrrsplot(out,'quant',[0.99;0.9999]);

  • Example of option datatooltip.
  • Example of the use of function mdrrsplot with datatooltip passed as scalar (that is using default options for datacursor (i.e.

    % DisplayStyle =window)
    load('loyalty.txt','loyalty');
    y=loyalty(:,4);
    X=loyalty(:,1:3);
    [out]=FSRmdrrs(y,X);
    mdrrsplot(out,'datatooltip',1);

    Related Examples

    expand all

  • Example of the use option datatooltip passed as structure.
  • load('loyalty.txt','loyalty');
    y=loyalty(:,4);
    X=loyalty(:,1:3);
    [out]=FSRmdrrs(y,X);
    tooltip=struct;
    tooltip.SnapToDataVertex='on'
    tooltip.DisplayStyle='datatip'
    mdrrsplot(out,'datatooltip',tooltip);

  • Example of the use of option envm.
  • Example of the use of function mdrplot with personalized envelopes.

    load('loyalty.txt','loyalty');
    y=loyalty(:,4);
    X=loyalty(:,1:3);
    [out]=FSRmdrrs(y,X);
    %In this case the resuperimposed envelope is based on n-2 observations
    mdrrsplot(out,'envm',length(out.y)-2);

  • Interactive example 1. Example of the use of function mdrplot with option databrush.
  • load('loyalty.txt','loyalty');
    y=loyalty(:,4);
    X=loyalty(:,1:3);
    % Note that in this case it is necessary to call function FSRmdrrs in
    % order to save the units belonging to subset for all the steps of the
    % forward search.
    [out]=FSRmdrrs(y,X,'bsbsteps',0);
    brushedUnits=mdrrsplot(out,'databrush',1);

  • Interactive example 2. Example where databrush is a structure and option labeladd is used X = load('X.
  • X  = load('X.txt');
    y = X(:,end);
    X =X(:,1:end-1);
    [out]=FSRmdrrs(y,X,'bsbsteps',0);
    databrush=struct
    databrush.selectionmode='Lasso'
    databrush.labeladd='1';
    mdrrsplot(out,'databrush',databrush)

  • Interactive example 3. Example of the use of option databrush using brush mode X = load('X.
  • X  = load('X.txt');
    y = X(:,end);
    X =X(:,1:end-1);
    [out]=FSRmdrrs(y,X);
    databrush=struct
    databrush.selectionmode='Brush'
    mdrrsplot(out,'databrush',databrush)

  • Interactive example 4. Example of the use of persistent non cumulative brush.
  • Every time a brushing action is performed previous highlights are removed but the labels are not removed from the scatterplot matrix.

    % If persist is 'off' after each selection, all trajectories except
    % those selected in the current iteration are plotted in
    % greysh color. If persist is 'on' after each selection, trajectories
    % never selected in any iteration are plotted in greysh color.
    X  = load('X.txt');
    y = X(:,end);
    X =X(:,1:end-1);
    [out]=FSRmdrrs(y,X);
    databrush=struct
    databrush.persist='off'
    databrush.labeladd='1';
    databrush.RemoveLabels='off';
    mdrrsplot(out,'databrush',databrush)

  • Interactive example 5. Example of the use of persistent cumulative brush.
  • Every time a brushing action is performed current highlights are added to previous highlights.

    % If persist is 'off' after each selection, all trajectories except
    % those selected in the current iteration are plotted in
    % greysh color. If persist is 'on' after each selection, trajectories
    % never selected in any iteration are plotted in greysh color.
    X  = load('X.txt');
    y = X(:,end);
    X =X(:,1:end-1);
    [out]=FSRmdrrs(y,X);
    databrush=struct
    databrush.persist='on';
    databrush.selectionmode='Rect'
    % outV is the vector of all selected units during brushing
    % outM is a matrix, each column contains the groups of selected units 
    % at each brushing action
    [outV, outM]=mdrrsplot(out,'databrush',databrush)

    Input Arguments

    expand all

    out — Structure containing the following fields. out.mdrrs = a matrix of size (n-ninit)-by-(nsimul+1)containing the monitoring of minimum deletion residual in each step of the forward search for each of the nsimul random starts.

    The first column of mdr must contain the fwd search index This matrix can be created using function FSRmdrrs out.BBrs = 3D array of size n-by-n-(init)-by-nsimul containing units forming subset for each random start.

    This field is necessary if datatooltip is true or databrush is not empty.

    out.y = a vector containing the response (necessary only if option databrush is not empty) out.X = a matrix containing the explanatory variables (necessary only if option databrush is not empty)

    Data Types: single| double

    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: 'quant',[0.01 0.99] , 'envm',n , 'xlimx',[20 100] , 'ylimy',[2 6] , 'lwdenv',2 , 'tag','mymdrrs' , 'datatooltip',1 , 'databrush',1 , 'FontSize',14 , 'ColorTrj',0 , 'SizeAxesNum',14 , 'nameX',{'Age','Income','Married','Profession'} , 'namey','mylabel'} , 'lwd',3 , 'namey','Plot title' , 'labx','Subset size m' , 'laby','mmd'

    quant —vector containing quantiles for which envelopes have to be computed.vector | scalar.

    The default is to produce 1%, 50% and 99% envelopes. In other words the default is quant=[0.01;0.5;0.99];

    Example: 'quant',[0.01 0.99]

    Data Types: double

    envm —Size of the sample which is used to superimpose the envelope.scalar.

    The default is to add an envelope based on all the observations (size n envelope).

    Example: 'envm',n

    Data Types: double

    xlimx —vector with two elements controlling minimum and maximum on the x axis.default value is mdr(1,1)-3 and mdr(end,1)*1.

    3

    Example: 'xlimx',[20 100]

    Data Types: double

    ylimy —min and max on the y axis.vector.

    Vector with two elements controlling minimum and maximum on the y axis. Default value is min(mdr(:,2)) and max(mdr(:,2));

    Example: 'ylimy',[2 6]

    Data Types: double

    lwdenv —Line width of the envelopes.scalar.

    Scalar which controls the width of the lines associated with the envelopes. Default is lwdenv=1.

    Example: 'lwdenv',2

    Data Types: double

    tag —tag of the plot.string.

    String which identifies the handle of the plot which is about to be created. The default is to use tag 'pl_mdrrs'. Notice that if the program finds a plot which has a tag equal to the one specified by the user, then the output of the new plot overwrites the existing one in the same window else a new window is created

    Example: 'tag','mymdrrs'

    Data Types: char

    datatooltip —empty value or structure.the default is datatooltip='' If datatooltip is not empty the user can use the mouse in order to have information about the unit seected, the step in which the unit enters the search and the associated label.

    If datatooltip is a structure, it is possible to control the aspect of the data cursor (see function datacursormode for more details or the examples below). The default options of the structure are DisplayStyle='Window' and SnapToDataVertex='on'

    Example: 'datatooltip',1

    Data Types: empty value, numeric or structure

    databrush —interactive mouse brushing.empty value (default), scalar | structure.

    DATABRUSH IS AN EMPTY VALUE .

    If databrush is an empty value (default), no brushing is done. The activation of this option (databrush is a scalar or a structure) enables the user to select a set of trajectories in the current plot and to see them highlighted in the spm (notice that if the spm does not exist it is automatically created).

    In addition, units forming subset in the selected steps selected trajectories can be highlighted in the monitoring MD plot Note that the window style of the other figures is set equal to that which contains the monitoring residual plot. In other words, if the monitoring residual plot is docked all the other figures will be docked too.

    DATABRUSH IS A SCALAR.

    If databrush is a scalar the default selection tool is a rectangular brush and it is possible to brush only once (that is persist='').

    DATABRUSH IS A STRUCTURE.

    If databrush is a structure, it is possible to use all optional arguments of function selectdataFS and the following optional argument: persist. Persist is an empty value or a scalar containing the strings 'on' or 'off' If persist = 'on' or 'off' brusing can be done as many time as the user requires. If persist='on' then the unit(s) currently brushed are added to those previously brushed. If persist='off' every time a new brush is performed units previously brushed are removed. The default value of persist is '' that is brushing is allowed only once. If persist is 'on' it is possible, every time a new brushing is done, to use a different color for the brushed units labeladd. If this option is '1', we label the units of the last selected group with the unit row index in matrices X and y. The default value is labeladd='', i.e. no label is added.

    Example: 'databrush',1

    Data Types: single | double | struct

    FontSize —Label font size.scalar.

    Scalar which controls the fontsize of the labels of the axes. Default value is 12

    Example: 'FontSize',14

    Data Types: single | double

    ColorTrj —Color of trajectories.scalar.

    Integer which controls the color of the trajectories. Default value is 1, which rotates fixed colors. ColorTrj = 0 produces a colormap proportional to sum or mdr along a relevant part of the trajectory. ColorTrj > 1 can be used for rotating fixed colors for the ColorTrj trajectories with larger mdr; no more than 7 trajectories will be considered. ColorTrj > 1 also adds a marker every 10 steps. Note that if the largest mdr are in the final part of the search (due to a group of outliers), the peak is not informative and it is therefore not considered.

    Example: 'ColorTrj',0

    Data Types: single | double

    SizeAxesNum —Size of axes numbers.scalar.

    Scalar which controls the fontsize of the numbers of the axes.

    Default value is 10.

    Example: 'SizeAxesNum',14

    Data Types: single | double

    nameX —cell array of strings of length p containing the labels of the varibles of the regression dataset.if it is empty (default) the sequence X1, .

    .., Xp will be created automatically

    Example: 'nameX',{'Age','Income','Married','Profession'}

    Data Types: cell

    namey —response label.character.

    Character containing the label of the response.

    Example: 'namey','mylabel'}

    Data Types: character

    lwd —Trajectories line width.scalar.

    Scalar which controls linewidth of the curve which contains the monitoring of minimum deletion residual.

    Default line width=2

    Example: 'lwd',3

    Data Types: single | double

    titl —titel label.charater.

    A label for the title (default: '')

    Example: 'namey','Plot title'

    Data Types: char

    labx —x axis title.character.

    A label for the x-axis (default: 'Subset size m').

    Example: 'labx','Subset size m'

    Data Types: char

    laby —y axis title.character.

    A label for the y-axis (default: 'Minimum deletion residual').

    Example: 'laby','mmd'

    Data Types: char

    Output Arguments

    expand all

    brushedUnits —List of the units which are inside subset in the trajectories which have been brushed using option databrush. brushed units. Vector. Vector

    If option databrush has not been used brushedUnits will be an empty value.

    BrushedUnits —brushed units. Matrix

    Matrix of size r-by-numBrushingActions which contains in column j the brushed units after jth brushing.

    If during jth brushing action the number of brushed units is $s<r$ the last $r-s$ units of column j are set to 0.

    References

    Atkinson and Riani (2000), Robust Diagnostic Regression Analysis, Springer Verlag, New York.

    This page has been automatically generated by our routine publishFS