Description Usage Arguments Details Value Author(s) References See Also Examples
This function v-fold cross-validates a discriminant analysis through the leave-v-out procedure.
1 | vcrossv.da(x, f, fold, nsimulat, funct)
|
x |
A matrix with samples in columns and taxa in rows. The rows must be named after taxa names (see |
f |
An object of class |
fold |
Value of v, i.e. number of elements to be left out in each validation. |
nsimulat |
Number of samples simulated to desaturate the model (see Correa-Metrio et al (in review) for details). If no samples were simulated |
funct |
|
The function was designed for discrimination of pollen taxa into dichotomous ecological groups (only admits two factors). The prior information corresponds to the affinity of certain taxa to known environmental conditions. Therefore, while the taxa corrrespond to the objects to classify, the percentages through the fossil dataset correspond to the attributes. Each time the discriminant function is adjusted, v elements are left out with no replacements. Therefore, it is recommended that v be smaller than half of the total taxa, unless there is a considerable number of species. Take also into consideration that each time a taxon is left out for the crossvalidation, all the samples that were simulated for such taxon are left out too.
A list containing:
posterior |
The a posteriori probability of each taxa belonging to each one of the defined groups. |
comp2 |
Binary classification of the taxa. |
accuracy |
The percentage of cases well classified in the cross-validation. |
Alexander Correa-Metrio, Kenneth R. Cabrera.
Correa-Metrio, A., K.R. Cabrera, and M.B. Bush. 2010. Quantifying ecological change through discriminant analysis: a paleoecological example from the Peruvian Amazon. Journal of Vegetation Science 21: 695-704.
Venables, W.N., and B.D. Ripley. 2002. "Modern applied statistics with S". Springer, New York.
vcrossv.all
.lda
and qda
(package MASS) for details on the discriminant functions. simulat
and simulat.t
for details on samples simulations.
1 2 3 4 5 6 7 8 9 10 11 | data(quexilper)
# Taking only a fraction of the data base so the model is not saturated
a<-quexilper[1:10,1:20]
a<-t(a)
# build a dummy factor assuming that the first 10 species belong
# to group1 and the send ten belong to group 2
b<-as.factor(rep(c("group1","group2"),each=10))
#to apply ordinary crossvalidation (leave-one-out)
vcrossv.da(a,b,fold=1,nsimulat=1,funct=lda)
#to apply 3-fold cross-validation
vcrossv.da(a,b,fold=3,nsimulat=1,funct=lda)
|
Loading required package: MASS
Loading required package: vegan
Loading required package: permute
Loading required package: lattice
This is vegan 2.5-4
$posterior
group1 group2
Betula 4.917464e-01 5.082536e-01
Croton 5.398228e-03 9.946018e-01
Celtis 2.811570e-07 9.999997e-01
Fraxinus 1.136283e-01 8.863717e-01
Citharexylum 5.736396e-01 4.263604e-01
Anacardiaceae.undiff. 3.275512e-01 6.724488e-01
Ficus 9.999692e-01 3.084540e-05
Bursera 9.938138e-01 6.186243e-03
Hasseltia 5.736396e-01 4.263604e-01
Gymnanthes 5.349213e-01 4.650787e-01
Alnus 9.054247e-01 9.457533e-02
Arecaceae 5.632804e-06 9.999944e-01
Alfaroa 2.383782e-01 7.616218e-01
Cornus 7.201106e-01 2.798894e-01
Bombacaceae 6.321979e-01 3.678021e-01
Byrsonima 1.000000e+00 4.315622e-16
Cecropia 1.000000e+00 7.260660e-39
Alchornea 3.006343e-01 6.993657e-01
Brosimum 5.523351e-184 1.000000e+00
Didymopanax 1.777434e-01 8.222566e-01
$classification
group1 group2
Betula 0 1
Croton 0 1
Celtis 0 1
Fraxinus 0 1
Citharexylum 1 0
Anacardiaceae.undiff. 0 1
Ficus 1 0
Bursera 1 0
Hasseltia 1 0
Gymnanthes 1 0
Alnus 1 0
Arecaceae 0 1
Alfaroa 0 1
Cornus 1 0
Bombacaceae 1 0
Byrsonima 1 0
Cecropia 1 0
Alchornea 0 1
Brosimum 0 1
Didymopanax 0 1
$accuracy
[1] 40
$posterior
group1 group2
Gymnanthes 2.826736e-01 7.173264e-01
Ficus 9.999944e-01 5.647650e-06
Betula 2.637106e-01 7.362894e-01
Didymopanax 1.149117e-01 8.850883e-01
Alfaroa 5.051651e-01 4.948349e-01
Cornus 5.051891e-01 4.948109e-01
Alchornea 1.834503e-01 8.165497e-01
Celtis 2.832694e-10 1.000000e+00
Citharexylum 6.900987e-01 3.099013e-01
Alnus 9.999695e-01 3.052392e-05
Croton 2.562013e-04 9.997438e-01
Hasseltia 5.509731e-01 4.490269e-01
Fraxinus 6.326871e-05 9.999367e-01
Bursera 1.000000e+00 3.508961e-20
Arecaceae 5.069359e-09 1.000000e+00
Anacardiaceae.undiff. 2.676353e-01 7.323647e-01
Bombacaceae 3.522812e-01 6.477188e-01
Byrsonima 1.000000e+00 7.008305e-15
$classification
group1 group2
Gymnanthes 0 1
Ficus 1 0
Betula 0 1
Didymopanax 0 1
Alfaroa 1 0
Cornus 1 0
Alchornea 0 1
Celtis 0 1
Citharexylum 1 0
Alnus 1 0
Croton 0 1
Hasseltia 1 0
Fraxinus 0 1
Bursera 1 0
Arecaceae 0 1
Anacardiaceae.undiff. 0 1
Bombacaceae 0 1
Byrsonima 1 0
$accuracy
[1] 50
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.