oslda: Observation Specific Linear Discriminant Analysis

Description Usage Arguments Details Value References See Also

View source: R/oslda.R

Description

A localized version of Linear Discriminant Analysis.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
  oslda(x, ...)

  ## S3 method for class 'formula'
 oslda(formula, data, ..., subset,
    na.action)

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

  ## S3 method for class 'matrix'
 oslda(x, grouping, ..., subset,
    na.action = na.fail)

  ## Default S3 method:
 oslda(x, grouping,
    wf = c("biweight", "cauchy", "cosine", "epanechnikov", "exponential", "gaussian", "optcosine", "rectangular", "triangular"),
    bw, k, nn.only = TRUE, method = c("unbiased", "ML"),
    ...)

Arguments

formula

A formula of the form groups ~ x1 + x2 + ..., that is, the response is the grouping factor and the right hand side specifies the (non-factor) discriminators.

data

A data.frame from which variables specified in formula are to be taken.

x

(Required if no formula is given as principal argument.) A matrix or data.frame or Matrix containing the explanatory variables.

grouping

(Required if no formula is given as principal argument.) A factor specifying the class membership for each observation.

wf

A window function which is used to calculate weights that are introduced into the fitting process. Either a character string or a function, e.g. wf = function(x) exp(-x). For details see the documentation for wfs.

bw

(Required only if wf is a string.) The bandwidth parameter of the window function. (See wfs.)

k

(Required only if wf is a string.) The number of nearest neighbors of the decision boundary to be used in the fitting process. (See wfs.)

nn.only

(Required only if wf is a string indicating a window function with infinite support and if k is specified.) Should only the k nearest neighbors or all observations receive positive weights? (See wfs.)

method

Method for scaling the pooled weighted covariance matrix, either "unbiased" or maximum-likelihood ("ML"). Defaults to "unbiased".

...

Further arguments.

subset

An index vector specifying the cases to be used in the training sample. (NOTE: If given, this argument must be named.)

na.action

A function to specify the action to be taken if NAs are found. The default action is first the na.action setting of options and second na.fail if that is unset. An alternative is na.omit, which leads to rejection of cases with missing values on any required variable. (NOTE: If given, this argument must be named.)

Details

This is an alternative implementation of Local Linear Discriminant Analysis proposed by Czogiel et al. (2007) and implemented in loclda in package klaR.

The name of the window function (wf) can be specified as a character string. In this case the window function is generated internally in predict.oslda. Currently supported are "biweight", "cauchy", "cosine", "epanechnikov", "exponential", "gaussian", "optcosine", "rectangular" and "triangular".

Moreover, it is possible to generate the window functions mentioned above in advance (see wfs) and pass them to oslda.

Any other function implementing a window function can also be used as wf argument. This allows the user to try own window functions. See help on wfs for details.

If the predictor variables include factors, the formula interface must be used in order to get a correct model matrix.

Value

An object of class "oslda", a list containing the following components:

x

A matrix containing the explanatory variables.

grouping

A factor specifying the class membership for each observation.

counts

The number of observations per class.

lev

The class labels (levels of grouping).

N

The number of observations.

wf

The window function used. Always a function, even if the input was a string.

bw

(Only if wf is a string or was generated by means of one of the functions documented in wfs.) The bandwidth used, NULL if bw was not specified.

k

(Only if wf is a string or was generated by means of one of the functions documented in wfs.) The number of nearest neighbors used, NULL if k was not specified.

nn.only

(Logical. Only if wf is a string or was generated by means of one of the functions documented in wfs and if k was specified.) TRUE if only the k nearest neighbors recieve a positive weight, FALSE otherwise.

adaptive

(Logical.) TRUE if the bandwidth of wf is adaptive to the local density of data points, FALSE if the bandwidth is fixed.

method

The method for scaling the weighted covariance matrices, either "unbiased" or "ML".

variant

(Only if wf is a string or one of the window functions documented in wfs is used, for internal use only). An integer indicating which weighting scheme is implied by bw, k and nn.only.

call

The (matched) function call.

References

Czogiel, I., Luebke, K., Zentgraf, M. and Weihs, C. (2007), Localized linear discriminant analysis. In Decker, R. and Lenz, H.-J., editors, Advances in Data Analysis, volume 33 of Studies in Classification, Data Analysis, and Knowledge Organization, pages 133–140, Springer, Berlin Heidelberg.

See Also

predict.oslda.


locClass documentation built on May 2, 2019, 5:21 p.m.

Related to oslda in locClass...