Learn R Programming

rrlda (version 1.1)

rrlda: Robust Regularized Linear Discriminant Analysis

Description

Performs Robust Regularized Linear Discriminant Analysis.

Usage

rrlda(x, grouping, prior=NULL, lambda=0.5, hp=0.75, nssamples=30, maxit=50, penalty="L2")

Arguments

x
Matrix or data.frame of observations.
grouping
Grouping variable. A vector of numeric values >= 1 is recommended. Length has to correspond to nrow(x).
prior
Vector of prior probabilities for each group. If not supplied the priors are computed from the data.
lambda
Penalty parameter which controls the sparseness of the resulting inverse scatter matrix. Default is 0.5
hp
Robustness parameter which specifies the amount of observations to be included in the computations. Default is 0.75
nssamples
Number of start samples to be user for iterated estimations.
maxit
Maximum number of iterations of the algorithm. Default is 10.
penalty
Type of penalty to be applied. Possible values are "L1" and "L2".

Value

An object of class "rrlda" is returned which can be used for class prediction (see predict()). prior=prior, counts=counts, means=means, cov=covm, covi=covi, lev=lev, n=n, h=h, bic=bic, loglik=loglik, nonnuls=nonnuls, subs=est$subset
prior
Vector of prior probabilities.
counts
Number of obervations for each group.
means
Estimated mean vectors for each group.
covi
Estimated (common) inverse covariance matrix.
lev
Levels. Corresponds to the groups.
n
Number of observations.
h
Number of observations included in the computations (see robustness parameter alpha).
bic
Adapted bic value. Can be used for optimal selection of lambda
loglik
The maximized (log-)likelihood value.
df
Degrees of freedom of the estimated inverse covariance matrix.
subs
An index vector specifying the data subset used (see robustness parameter alpha).

Details

Performs Robust Regularized Discriminant Analysis using a sparse estimation of the inverse covariance matrix. The sparseness is controlled by a penalty parameter lambda. Possible outliers are dealt with by a robustness parameter alpha which specifies the amount of observations for which the likelihood function is maximized.

Examples

Run this code
	data(iris)
	x <- iris[,1:4]
	rr <- rrlda(x, grouping=as.numeric(iris[,5]), lambda=0.2, hp=0.75) ## perform rrlda
	pred <- predict(rr, x) ## predict 
	table(as.numeric(pred$class), as.numeric(iris[,5])) ## show errors

Run the code above in your browser using DataLab