Description Usage Arguments Details Value Note Author(s) References See Also Examples

Build linear classification rules with additional information expressed as inequality restrictions among the populations means.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 |

`formula` |
A formula of the form |

`data` |
Data frame from which variables specified in |

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

`grouping` |
(Required if no formula is given as the principal argument.) A numeric vector or factor with numeric levels specifying the class for each observation. |

`subset` |
An index vector specifying the cases to be used in the training sample. |

`resmatrix` |
A matrix specifying the linear restrictions on the mean vectors: |

`restext` |
(Required if no |

`gamma` |
A vector of values in the unit interval that determine the classification rules with additional information (see references). |

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

`...` |
Arguments passed to or from other methods. |

Specifying the `prior`

will affect the classification and error unless over-ridden in `predict.rlda`

and `err.est.rlda`

, respectively.

An object of class `'rlda'`

containing the following components:

`call` |
The (matched) function call. |

`trainset` |
Matrix with the training set used (first columns) and the class for each observation (last column). |

`restrictions` |
Edited character string with the linear restrictions on the mean vectors detailed. |

`resmatrix` |
The matrix with the restrictions on the mean vectors used. |

`prior` |
Prior probabilities of class membership used. |

`counts` |
The number of observations of the classes used. |

`N` |
The total number of observations used. |

`samplemeans` |
Matrix with the sample means in rows. |

`samplevariances` |
Array with the sample covariance matrices of the classes. |

`gamma` |
Gamma values used. |

`spooled` |
Pooled covariance matrix. |

`estimatedmeans` |
Array with the estimated means for each classification rule. |

`apparent` |
Apparent error rate for each classification rule. |

This function may be called giving either a formula and data frame, or a data frame and grouping factor, or a matrix and grouping factor as the first two arguments. All other arguments are optional.

Classes must be identified, either in a column of `data`

or in the `grouping`

vector, by natural numbers varying from 1 to the number of classes. The number of classes must be greater than 1.

If there are missing values in either `data`

, `x`

or `grouping`

, corresponding observations will be deleted.

To overcome singularity of the covariance matrices, the number of observations in each class must be greater or equal than the number of explanatory variables.

David Conde

Conde, D., Fernandez, M. A., Rueda, C., and Salvador, B. (2012). Classification of samples into two or more ordered populations with application to a cancer trial. *Statistics in Medicine*, **31**, 3773-3786.

Conde, D., Fernandez, M. A., Salvador, B., and Rueda, C. (2015). dawai: An R Package for Discriminant Analysis with Additional Information. *Journal of Statistical Software*, **66(10)**, 1-19. URL http://www.jstatsoft.org/v66/i10/.

Fernandez, M. A., Rueda, C., Salvador, B. (2006). Incorporating additional information to normal linear discriminant rules. *Journal of the American Statistical Association*, **101**, 569-577.

`predict.rlda`

, `err.est.rlda`

, `rqda`

, `predict.rqda`

, `err.est.rqda`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ```
data(Vehicle2)
levels(Vehicle2$Class)
## "bus" "opel" "saab" "van"
data <- Vehicle2
levels(data$Class) <- c(4, 2, 1, 3)
## classes ordered by increasing size
##
## according to variable definitions, we can
## consider the following restrictions on the means vectors:
## mu11, mu21 >= mu31 >= mu41
## mu12, mu22 >= mu32 >= mu42
##
## we have 6 restrictions, 3 predictors and 4 classes, so
## resmatrix must be a 6 x 12 matrix:
A <- matrix(0, ncol = 12, nrow = 6)
A[t(matrix(c(1, 1, 2, 2, 3, 4, 4, 5, 5, 7, 6, 8), nrow = 2))] <- -1
A[t(matrix(c(1, 7, 2, 8, 3, 7, 4, 8, 5, 10, 6, 11), nrow = 2))] <- 1
set.seed(983)
values <- runif(dim(data)[1])
trainsubset <- values < 0.2
obj <- rlda(Class ~ Kurt.Maxis + Holl.Ra + Sc.Var.maxis,
data, subset = trainsubset, gamma = c(0, 0.5, 1),
resmatrix = A)
obj
## we can see that the apparent error rate of the restricted
## rules decrease with gamma:
## gamma=0 gamma=0.5 gamma=1
## 42.30769 41.66667 41.02564
``` |

dawai documentation built on May 3, 2021, 9:06 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.