Dlda {HiDimDA}R Documentation

Diagonal Linear Discriminant Analysis.

Description

‘Dlda’ finds the coefficients of a linear discriminant rule based on a Diagonal covariance matrix estimator.

Usage


## Default S3 method:
Dlda(data, grouping, prior = "proportions", VSelfunct = SelectV, 
ldafun=c("canonical","classification"), ...)

## S3 method for class 'data.frame'
Dlda(data, ...)

Arguments

data

Matrix or data frame of observations.

grouping

Factor specifying the class for each observation.

prior

The prior probabilities of class membership. If unspecified, the class proportions for the training set are used. If present, the probabilities should be specified in the order of the factor levels.

VSelfunct

Variable selection function. Either the string “none” (no selection is to be performed) or a function that takes ‘data’ and ‘grouping’ as its first two arguments and returns a list with two components: (i) ‘nvkpt’ - the number of variables to be used in the Discriminant rule; and (ii) ‘vkptInd’ - the indices of the variables to be used in the Discriminant rule. The default is the ‘SelectV’ function that, by default, selects variables by the Expanded HC scheme described in Duarte Silva (2011).

ldafun

Type of discriminant linear functions computed. The alternatives are “canonical” for maximum-discrimination canonical linear functions and “classification” for direct-classification linear functions.

...

Further arguments passed to or from other methods.

Value

If algument ‘ldafun’ is set to “canonical” an object of class ‘canldaRes’ with the following components:

prior

The prior probabilities used.

means

The class means.

scaling

A matrix which transforms observations to discriminant functions, normalized so that the within groups covariance matrix is spherical.

svd

The singular values, which give the ratio of the between- and within-group standard deviations on the linear discriminant variables. Their squares are the canonical F-statistics.

vkpt

A vector with the indices of the variables kept in the discriminant rule if the number of variables kept is less than ‘ncol(data)’. NULL otherwise.

nvkpt

The number of variables kept in the discriminant rule if this number is less than‘ncol(data)’. NULL otherwise.

N

The number of observations used.

call

The (matched) function call.

If algument ‘ldafun’ is set to “classification” an object of class ‘clldaRes’ with the following components:

prior

The prior probabilities used.

means

The class means.

coef

A matrix with the coefficients of the k-1 classification functions.

cnst

A vector with the thresholds (2nd members of linear classification rules) used in classification rules that assume equal priors.

vkpt

A vector with the indices of the variables kept in the discriminant rule if the number of variables kept is less than ‘ncol(data)’. NULL otherwise.

nvkpt

The number of variables kept in the discriminant rule if this number is less than‘ncol(data)’. NULL otherwise.

N

The number of observations used.

call

The (matched) function call.

Author(s)

A. Pedro Duarte Silva

See Also

SelectV, DMat, predict.canldaRes, predict.clldaRes, AlonDS

Examples


# train classifier on Alon's Colon Cancer Data Set 
#(after a logarithmic transformation). 

log10genes <- log10(AlonDS[,-1])


ldarule <- Dlda(log10genes,AlonDS$grouping)     

# show classification rule

print(ldarule)

# get in-sample classification results

predict(ldarule,log10genes,grpcodes=levels(AlonDS$grouping))$class           	       

# compare classifications with true assignments

cat("Original classes:\n")
print(AlonDS$grouping)             		 

# Estimate error rates by four-fold cross-validation.
# Note: In cross-validation analysis it is recommended to set 
# the argument 'ldafun' to "classification", in order to speed up 
# computations by avoiding unecessary eigen-decompositions 

## Not run: 

CrosValRes <- DACrossVal(log10genes,AlonDS$grouping,TrainAlg=Dlda,
ldafun="classification",kfold=4,CVrep=1)
summary(CrosValRes[,,"Clerr"])


## End(Not run)
         	       

[Package HiDimDA version 0.2-6 Index]