Learn R Programming

robustfa (version 1.0-4)

myplotDD: Distance-Distance Plot

Description

"myplotDD" is a revised version of ".myddplot" in "plot-utils.R" in the package "rrcov". In "myplotDD", id.n and ind are printed out.

Usage

myplotDD(x, cutoff, id.n)

Arguments

x
An S4 object of class "CovRobust".
cutoff
The cutoff value used. If missing, cutoff <- sqrt(qchisq(0.975, p)) by default.
id.n
Number of observations to identify by a label. If not supplied, the number of observations with robust distance larger than cutoff is used.

Value

  • A distance-distance plot is shown. Return a list with components:
  • cutoffThe cutoff value used. If missing, cutoff <- sqrt(qchisq(0.975, p)) by default.
  • id.nNumber of observations to identify by a label. If not supplied, the number of observations with robust distance larger than cutoff is used.
  • sort.yA list containing the sorted values of y (the robust distance)
  • indThe indices of the largest id.n observations whose robust distances are larger than cutoff.

Details

Distance-Distance Plot: Plot the vector y=rd (robust distances) against x=md (mahalanobis distances). Identify by a label the id.n observations with largest rd. If id.n is not supplied, calculate it as the number of observations larger than cutoff. Use cutoff to draw a horisontal and a vertical line. Draw also a dotted line with a slope 1. "myplotDD(x)" is equivalent to "plot(x, which="dd")". which: indicate what kind of plot. If which = "dd", then a distance-distance Plot.

References

Zhang, Y. Y. (2013), An Object Oriented Solution for Robust Factor Analysis.

See Also

plot, qchisq, CovClassic, getDistance

Examples

Run this code
data(stock611)
covMcd=CovRobust(x=scale(stock611[,3:12]), control="mcd"); covMcd

## "myplotDD" shows id.n and ind.
## Note: id.n and ind change each time due to covMcd changes each time!
## However, the ind of largest robust distances do not change.
result = myplotDD(x=covMcd); result

## "myplotDD" is equivalent to "plot(x=covMcd, which="dd")".
plot(x=covMcd, which="dd")

Run the code above in your browser using DataLab