rgr (version 1.1.15)

gx.mvalloc.print: Function to display the results of Multivariate Allocation

Description

Function to extract and display the results from the saved object from gx.mvalloc or gx.mvalloc.closed. The function displays on the current device only those individuals (observations, cases or samples) whose predicted probability of reference group membership (typicality) was less than the value provided, pcrit, for all reference groups, i.e. the outliers. Alternately, the results can be saved as a ‘.csv’ file for viewing with a spreadsheet program and any subsequent post-processing.

Usage

gx.mvalloc.print(save, ifprint = TRUE, unalloc = TRUE, file = NULL)

Arguments

save

an object saved from gx.mvalloc.

ifprint

by default the ‘outliers’, i.e. individuals classified into group ‘zero’, are displayed on the current device. The display consists of the input matrix row numbers together with the predicted probabilities of reference group membership for the 1:kk reference groups. To suppress the display set ifprint = FALSE.

unalloc

by default, unalloc = TRUE, individuals that were not allocated to one of the reference groups are displayed. To suppress displaying these individuals, set unalloc = FALSE.

file

the name of the folder where the file is to be saved, a ‘/’ is appended before the synthesized file name, details of which are displayed on the current device. If no file is specified, the files are saved to the Working Directory, see Details below.

Details

The full table of Mahalanobis distances and group membership probabilities may be saved as a ‘.csv’ file. If a folder name has been provided in file, a ‘/’ is appended prior a file name synthesized from the name of the saved object concatenated with ‘_mvalloc.csv’, see Example below. If file = "" or file = " " the file will be saved to the Working Directory. The file name for the .csv file is displayed on the current device, and all other output is suppressed. The output file can be inspected with spread sheet software or a viewer of the user's choice.

See Also

gx.mvalloc, gx.mvalloc.closed

Examples

Run this code
# NOT RUN {
## Make test data available
data(ogrady)
attach(ogrady)
ogrady.grdr <- gx.subset(ogrady, Lith == "GRDR")
ogrady.grnt <- gx.subset(ogrady, Lith == "GRNT")
## Ensure all data are in the same units (mg/kg)
ogrady.grdr.2open <- ogrady.grdr[, c(5:14)]
ogrady.grdr.2open[, 1:7] <- ogrady.grdr.2open[, 1:7] * 10000
ogrady.grnt.2open <- ogrady.grnt[, c(5:14)]
ogrady.grnt.2open[, 1:7] <- ogrady.grnt.2open[, 1:7] * 10000
ogrady.2open <- ogrady[, c(5:14)]
ogrady.2open[, 1:7] <- ogrady.2open[, 1:7] * 10000 

## Create reference data sets
ogrady.grdr.save <- gx.md.gait(ilr(as.matrix(ogrady.grdr.2open)),
mcdstart = TRUE)
ogrady.grnt.save <- gx.md.gait(ilr(as.matrix(ogrady.grnt.2open)),
mcdstart = TRUE)

## Allocate all O'Grady granitoids
ogrady.mvalloc <- gx.mvalloc(pcrit = 0.02, ilr(as.matrix(ogrady.2open)),
ogrady.grdr.save, ogrady.grnt.save)

## Display list of outliers
gx.mvalloc.print(ogrady.mvalloc)

## Save allocations as a .csv file, not executed
## gx.mvalloc.print(ogrady.mvalloc, ifprint = FALSE, file = "D://R_work//Project3")

## Clean-up and detach test data
rm(ogrady.grdr)
rm(ogrady.grnt)
rm(ogrady.grdr.2open)
rm(ogrady.grnt.2open)
rm(ogrady.2open)
rm(ogrady.grdr.save)
rm(ogrady.grnt.save)
rm(ogrady.mvalloc)
detach(ogrady)
# }

Run the code above in your browser using DataLab