Learn R Programming

rgr (version 1.1.0)

gx.md.plot: Function to Display Chi-square Plots of Mahalanobis Distances

Description

Function to display Chi-square plots of Mahalanobis distances from objects saved from gx.md.gait, gx.mva and gx.robmva. The actual plotting of the displays is undertaken by function gx.md.plt0. The function facilitates making cosmetic changes to the Chi-square plots not so easily achieved in function gx.md.gait, and not possible in functions gx.mva and gx.robmva.

Usage

gx.md.plot(save, main = "", ifadd = c(0.98, 0.95, 0.9), cexf = 0.6,
	cex = 0.8, ...)

Arguments

save
a saved object from the execution of function gx.md.gait, gx.mva or gx.robmva.
main
an alternate Chi-square plot title to that in the saved object, see Details below.
ifadd
if probability based fences are to be displayed on the Chi-square plots enter the probabilities here, see Details below. For no fences set ifadd = NULL.
cexf
the text scale expansion factor for the annotation of the probability based fences, by default cexf = 0.6.
cex
the text scale expansion factor for the other annotation within the frame of the Chi-square plot, by default cex = 0.8.
...
further arguments to be passed to methods concerning the generated plots. For example, if some colour other than black is required for the plotting characters, specify col = 2 to obtain red (see disp

Details

If main is undefined the name of the matrix object from which the Mahalanobis distances were derived is passed to the function via the saved object. Using the matrix name is the recommended procedure as it helps to track the progression during a GAIT exercise, and acts as a record of the data source. However, at a presentation stage an alternate plot title may preferred and can be defined in this function, e.g., main = "Plot Title Text". If no plot title is required set main = "". By default three fences are placed on the Chi-square plots at probabilities of membership of the current core data subset, or total data if appropriate, with ifadd = c(0.98, 0.95, 0.9). Alternate probabilities may be defined as best for the display. If no fences are required set ifadd = NULL. The Mahalanobis distance, Chi-square, plot x-axis label is set appropriately to indicated the type of robust start or trim using the value of proc from the saved object passed to the function.

See Also

gx.md.gait, gx.mva, gx.robmva, gx.add.chisq

Examples

Run this code
## Make test data available
data(sind)
attach(sind)
sind.mat <- as.matrix(sind[, -c(1:3)])
## Ensure all data are in the same units (mg/kg)
sind.mat2open <- sind.mat
sind.mat2open[, 2] <- sind.mat2open[, 2] * 10000

## Save and display Chi-square plot
sind.save <- gx.mva(ilr(sind.mat2open))
gx.md.plot(sind.save)
gx.md.plot(sind.save,
main = "Howarth & Sinding Larsen Stream Sediments
ilr transform",
cexf = 0.8, cex = 1, col = 2)

## Save and display Chi-square plot with a
## mcd robust start and ilr transformation
sind.save <- gx.md.gait(ilr(sind.mat2open), mcdstart = TRUE, mvtstart = TRUE,
trim = 3, ifadd = NULL)
gx.md.plot(sind.save)
gx.md.plot(sind.save,
main = paste("Howarth & Sinding-Larsen
Stream Sediments, ilr Transformed Data",
"MCD robust start"), ifadd = 0.9, cex.main = 0.8)

## Clean-up and detach test data
rm(sind.mat)
rm(sind.mat2open)
rm(sind.save)

Run the code above in your browser using DataLab