StatDA (version 1.7.4)

rg.mvalloc: Robust Multivariate Allocation Procedure

Description

Function to allocate an individual to one of several populations.

Usage

rg.mvalloc(pcrit = 0.05, x, ...)

Arguments

pcrit

When the probability of group membership is less than pcrit it is allocated to group 0.

x

contains the individuals to be allocated

arguments for creating a list of groups

Value

groups

the groups

m

number of groups

n

number of individuals to be allocated

p

number of columns

pgm

number of individuals to be allocated multiplied with the groups

pcrit

critical probability

xalloc

number of individuals as integer

Details

m objects are the reference populations generated by md.gait, rg.robmva or rg.mva to estimate Mahalanobis distancesand predicted probabilities of group membership for individuals in matrix x. Note that the log |determinant| of the appropriate covariance matrix is added to the Mahalanobis distance on the assumption that the covariance matrices are inhomogeneous. If the data require transformation this must be undertaken before calling this function. This implies that a similar transformation must have been used for all the reference data subsets.

References

C. Reimann, P. Filzmoser, R.G. Garrett, and R. Dutter: Statistical Data Analysis Explained. Applied Environmental Statistics with R. John Wiley and Sons, Chichester, 2008.

Examples

Run this code
# NOT RUN {
#input data
data(ohorizon)
vegzn=ohorizon[,"VEG_ZONE"]
veg=rep(NA,nrow(ohorizon))
veg[vegzn=="BOREAL_FOREST"] <- 1
veg[vegzn=="FOREST_TUNDRA"] <- 2
veg[vegzn=="SHRUB_TUNDRA"] <- 3
veg[vegzn=="DWARF_SHRUB_TUNDRA"] <- 3
veg[vegzn=="TUNDRA"] <- 3
el=c("Ag","Al","As","B","Ba","Bi","Ca","Cd","Co","Cu","Fe","K","Mg","Mn",
  "Na","Ni","P","Pb","Rb","S","Sb","Sr","Th","Tl","V","Y","Zn")
x <- log10(ohorizon[!is.na(veg),el])
v <- veg[!is.na(veg)]

res.zone1=rg.mva(as.matrix(x[v==1,]))
res.zone2=rg.mva(as.matrix(x[v==2,]))
res.zone3=rg.mva(as.matrix(x[v==3,]))
res=rg.mvalloc(pcrit=0.01,x,res.zone1,res.zone2,res.zone3)
# }

Run the code above in your browser using DataCamp Workspace