## 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
## To multivariate trim as in IDEAS, see JGE (1989) 32(1-3):319-341, execute:
gx.md.gait(sind.mat)
sind.gait.1 <- gx.md.gait(sind.mat, trim = 0.24, ifadd = 0.98)
sind.gait.2 <- gx.md.gait(sind.mat, wts = sind.gait.1$wts, mvtstart = TRUE,
trim = 4, ifadd = 0.98)
sind.gait.3 <- gx.md.gait(sind.mat, wts = sind.gait.2$wts, trim = 1,
ifadd = 0.9)
sind.gait.4 <- gx.md.gait(sind.mat, wts = sind.gait.3$wts, trim = 2,
ifadd = 0.9)
## To multivariate trim with a mcd start and an ilr transformation for closure:
gx.md.gait(ilr(sind.mat2open),ifadd = 0.95)
sind.gait.1 <- gx.md.gait(ilr(sind.mat2open), mcdstart = TRUE, ifadd = NULL)
sind.gait.2 <- gx.md.gait(ilr(sind.mat2open), wts = sind.gait.1$wts,
mvtstart = TRUE, trim = 3, ifadd = 0.9)
sind.gait.3 <- gx.md.gait(ilr(sind.mat2open), wts = sind.gait.2$wts, trim = 1,
ifadd = 0.9)
## Display saved objects with alternate main titles and list outliers
## IDEAS procedure
gx.md.plot(sind.gait.4,
main = "Howarth & Sinding-Larsen
Stream Sediments, IDEAS procedure",
cex.main = 0.8, ifadd = 0.9)
gx.md.print(cbind(sind.gait.4$md, sind.gait.4$ppm, ID, Zn, Cu, Cd, Fe, Mn),
pcut = 0.2)
## mcd robust start and ilr transformation
gx.md.plot(sind.gait.3,
main = "Howarth & Sinding-Larsen
Stream Sediments, ilr Transformed Data",
cex.main = 0.8)
gx.md.print(cbind(sind.gait.3$md, sind.gait.3$ppm, ID, Zn, Cu, Cd, Fe, Mn),
pcut = 0.2)
## Clean-up and detach test data
rm(sind.mat)
rm(sind.mat2open)
rm(sind.gait.1)
rm(sind.gait.2)
rm(sind.gait.3)
rm(sind.gait.4)
detach(sind)
Run the code above in your browser using DataLab