Learn R Programming

rgr (version 1.1.0)

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. The function displays on the current device only those individuals (observations, cases or samples) whose predicted probability of reference group membership was less than the value provided, pcrit, for all reference groups, i.e. the outliers. All 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, filename = 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
unalloc
by default, unalloc = TRUE, individuals that were not allocated to one on the reference groups are displayed. To suppress displaying these individuals, set unalloc = FALSE.
filename
the name of the csv file for allocation outcomes for the total data set to be saved in the working directory, see Example below.

See Also

gx.mvalloc

Examples

Run this code
## 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
gx.mvalloc.print(ogrady.mvalloc, ifprint = FALSE, file = "ogrady.mvalloc.csv")

## 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