ldaPlus {multiUS} | R Documentation |
The function performs a linear discriminant analysis (by using the MASS::lda
function).
Compared to the MASS::lda
function, the ldaPlus
function enable to consider the prior probabilities to predict the values of a categorical variable, it
provides with predicted values and with (Jack-knife) classification table and also with statistical test of canonical correlations
between the variable that represents groups and numberic variables.
ldaPlus(x, grouping, pred = TRUE, CV = TRUE, usePriorBetweenGroups = TRUE, ...)
x |
A data frame with values of numeric variables. |
grouping |
Categorical variable that defines groups. |
pred |
Wheter to retun the predicted values based on the model. Default is |
CV |
Whether to do cross-valiation in addition to "ordinary" analyisis, default is |
usePriorBetweenGroups |
Wheter to use prior probabilites aslo in estimating the model (compared to only in prediction); default is |
... |
Arguments passed to function |
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. |
The specified prior
is not taken into account when computing eigenvalues and all statistics based on them (everything in components eigModel
and sigTest
of the returned value).
The following objects are also a part of what is returned by the MASS::lda
function.
prior
- Prior probabilities of class membership taken to estimate the model (it can be estimated based on the sample data or it can be provided by a reseacher).
counts
- Number of units in each category of categorical variable taken to estimate the model.
means
- Group means.
scaling
- Matrix that transforms observations to discriminant functions, normalized so that within groups covariance matrix is spherical.
lev
- Levels (groups) of the categorical variable.
svd
- Singular values, that give the ratio of the between-group and within-group standard deviations on linear discriminant variables. Their squares are the canonical F-statistics.
N
- Number of observations used.
call
- the (matched) function call.
The additional following objects are generated by the multiUS::ldaPlus
function.
standCoefWithin
- Standardized coeficients (within groups) of discriminant function.
standCoefTotal
- Standardized coeficients of discriminant function.
betweenGroupsWeights
- Porportions/priors used when estimating the model.
sigTest
- Test of canonical correlations between the variable that represent groups (binary variable) and numeric variables (see function testCC
for more details) (Ho: The current and all the later canonical correlations equal to zero.).
eigModel
- Table with eigenvalues and canonical correlations (see function testCC
for more details).
centroids
- Means of discriminant variables by levels of categorical variable (not predicted, but actual).
corr
- Pooled correlations whithin groups (correlations between values of numberical variables and values of linear discriminat function(s)).
pred
class
- Predicted values of categorical variable
posterior
- Posterior probabilities (the values of the Fisher's calsification linear discrimination function)
x
- Estimated values of discriminat function(s) for each unit
class
- Classification table:
orgTab
- Frequency table.
perTab
- Percentages.
corPer
- Percentage of correctly predicted values (alternatively, percentage of correctly classified units).
classCV
- Similar to class
but based on cross validation (Jack-knife).
Aleš Žiberna
R Data Analysis Examples: Canonical Correlation Analysis, UCLA: Statistical Consulting Group. From http://www.ats.ucla.edu/stat/r/dae/canonical.htm (accessed Decembar 27, 2013).
ldaPlus(x = mtcars[,c(1, 3, 4, 5, 6)], grouping = mtcars[,10])