AMOVA negative value

1,733 views
Skip to first unread message

Jing Jin

unread,
Nov 10, 2016, 11:27:14 AM11/10/16
to poppr

Hi All,


I was trying to perform AMOVA test with my data set, which includes 96 isolates with 10 SSR markers. I divided 96 isolates into 4 populations by the years they were collected. 

I got negative value for the variations between samples within year. I was wondering why I got negative value? And the variations between year is around 0.8%, but the significance test gave a P value=0.0289 for it, is it telling me there is some structure there? I have no idea how to interpret my results, hope someone can help me out. I've attached my results below.

Thanks,
Jing  







Zhian Kamvar

unread,
Nov 10, 2016, 11:41:52 AM11/10/16
to poppr

Hi Jing,


Thank you for posting this on the forum. AMOVA in poppr performs in the same manner as in Arlequin. By default, within individual variance are calculated between haplotypes. You are seeing 191 df because there are 2n haplotypes in your sample (2 * 96) - 1 = 191. To calculate AMOVA without within individual distance, use within = FALSE. 


Below is an example using P. ramorum data:



library('poppr')
data
('Pram')
poppr
.amova(Pram, ~YEAR) # within individual calculation

##  No missing values detected.
##
## $call
## ade4::amova(samples = xtab, distances = xdist, structures = xstruct)
##
## $results
##                               Df    Sum Sq   Mean Sq
## Between YEAR                  15  101.0174 6.7344930
## Between samples Within YEAR  713  279.4771 0.3919735
## Within samples               729 1780.5000 2.4423868
## Total                       1457 2160.9945 1.4831809
##
## $componentsofcovariance
##                                               Sigma          %
## Variations  Between YEAR                 0.07413541   4.971141
## Variations  Between samples Within YEAR -1.02520666 -68.745118
## Variations  Within samples               2.44238683 163.773977
## Total variations                         1.49131558 100.000000
##
## $statphi
##                           Phi
## Phi-samples-total -0.63773977
## Phi-samples-YEAR  -0.72341307
## Phi-YEAR-total     0.04971141

poppr
.amova(Pram, ~YEAR, within = FALSE)
 
##  No missing values detected.
##
## $call
## ade4::amova(samples = xtab, distances = xdist, structures = xstruct)
##
## $results
##                  Df   Sum Sq    Mean Sq
## Between samples  15 200.8264 13.3884240
## Within samples  713 554.0461  0.7770632
## Total           728 754.8724  1.0369127
##
## $componentsofcovariance
##                                 Sigma         %
## Variations  Between samples 0.2948192  27.50481
## Variations  Within samples  0.7770632  72.49519
## Total variations            1.0718824 100.00000
##
## $statphi
##                         Phi
## Phi-samples-total 0.2750481
##


Hope that helps,

Zhian

Zhian Kamvar

unread,
Nov 10, 2016, 12:49:39 PM11/10/16
to poppr
I apologize. I appear to have answered a separate question (https://groups.google.com/d/msgid/poppr/20b1bdbb-5648-43ad-9d21-aa06864fde85%40googlegroups.com). There can be a number of reason why you are seeing negative variance. The best explanation I've seen is from Excoffier (http://cmpg.unibe.ch/software/arlequin/software/2.000/doc/faq/faqlist.htm):

Negative variance components can sometimes occur, because they are rather covariances. Their associated fixation indices can also be seen as correlation coefficients. Usually, slightly negative variance components can occur in absence of genetic structure, because the true value of the parameter you want to estimate is zero. Thus, if the expectation of the estimator is zero, you can have, by chance, slightly positive or slightly negative variance components. Most of the time, these negative variance components indicate an absence of genetic structure. They can have a biological meaning, though. For instance, in outcrossing organisms, genes from different populations can be more related to each other than genes from the same population.

That being said, you need to consider whether or not assessing within-individual variance makes sense in this context.

Again, I hope that helps.

Best,
Zhian 

Natalie Hofmeister

unread,
Jul 17, 2018, 4:28:32 PM7/17/18
to poppr
Hi Zhian,

I'm running an AMOVA, and I'm unsure whether to trust these results. Although the high variance within individuals is interesting here, it doesn't seem biologically plausible... however, I'm more concerned about the magnitude of the negative variance (sigma) observed between populations (see attached). 

Would it be correct to assume that poppr is controlling for within-individual and between-sample variance when testing for between-population variance, and that's why poppr finds no evidence of population structure? AMOVAs in pegas and adonis show significant population structure, but neither is testing for within-population variance. Regardless, "population" doesn't seem to matter much: in adonis and pegas, population explains only ~9% of the variance, and in poppr, it explains -0.26% of the variance. 

For background, my data come from sexually reproducing populations (n=158) with 3,000+ SNPs going into the genetic distance matrix. I find exceptionally low FST among "populations," no clear structure based on PCA, STRUCTURE, DAPC, etc.

Thanks for any insight you can provide!
Natalie
amova.pop.png
signifplot.png
amova.pop.signif.png

Zhian Kamvar

unread,
Jul 18, 2018, 8:56:24 AM7/18/18
to Natalie Hofmeister, poppr
Hi Natalie,

My first recommendation would be to run AMOVA again with the option: method = "pegas" just to make sure that what you are seeing is not a bug in the ade4 version. I think, here, however, Excoffier's explanation for negative variance still applies.

For example, if you take the "nancycats" data set, which has significant population structure, shuffle the data so that there is no association among the loci, you will quickly observe negative population variances:

library("poppr")
data(nancycats)
strata(nancycats) <- data.frame(pop = pop(nancycats))
set.seed(2018-07-18)
nan <- nancycats[pop = sample(nPop(nancycats), 5)]
poppr.amova(shufflepop(nan), ~pop)$componentsofcovariance
#>
#> Found 325 missing values.
#>
#> 3 loci contained missing values greater than 5%
#>
#> Removing 3 loci: fca8, fca45, fca96
#>                                              Sigma            %
#> Variations  Between pop                0.003163909   0.07312482
#> Variations  Between samples Within pop 0.187967071   4.34432753
#> Variations  Within samples             4.135593220  95.58254765
#> Total variations                       4.326724200 100.00000000
poppr.amova(shufflepop(nan), ~pop)$componentsofcovariance
#>
#> Found 325 missing values.
#>
#> 3 loci contained missing values greater than 5%
#>
#> Removing 3 loci: fca8, fca45, fca96
#>                                              Sigma          %
#> Variations  Between pop                 0.03266100   0.754275
#> Variations  Between samples Within pop -0.09237335  -2.133276
#> Variations  Within samples              4.38983051 101.379001
#> Total variations                        4.33011816 100.000000
poppr.amova(shufflepop(nan), ~pop)$componentsofcovariance
#>
#> Found 325 missing values.
#>
#> 3 loci contained missing values greater than 5%
#>
#> Removing 3 loci: fca8, fca45, fca96
#>                                               Sigma           %
#> Variations  Between pop                -0.006324753  -0.1463038
#> Variations  Between samples Within pop -0.026579525  -0.6148358
#> Variations  Within samples              4.355932203 100.7611396
#> Total variations                        4.323027925 100.0000000

Created on 2018-07-18 by the reprex package (v0.2.0).

Would it be correct to assume that poppr is controlling for within-individual and between-sample variance when testing for between-population variance, and that's why poppr finds no evidence of population structure? 

Yes. That being said, in the most technical terms, poppr itself is performing absolutely none of the calculations (aside from the distance matrix). All the calculations for AMOVA are happening either with pegas or ade4, both of which implement Excoffier's original model.

Hope that helps,
Zhian


--
You received this message because you are subscribed to the Google Groups "poppr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to poppr+unsubscribe@googlegroups.com.
To post to this group, send email to po...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/poppr/a0ed6233-306f-4061-9cfd-5a2b9fde8371%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

ana tiburcia

unread,
Mar 16, 2020, 11:44:13 PM3/16/20
to poppr
Hi everyone, 

I'm running an AMOVA in pegas, however the results were incomplete and with NA values, and I don't understand what could be wrong.

code:
cor_dist  <- dist(cor) # Euclidean distance
cor_stra  <- strata(cor)
cor_amova <- pegas::amova(cor_dist ~Host/City, data = cor_stra, nperm = 1000, is.squared = FALSE)
cor_amova

results (see attached)

Thanks for any help you can provide!

Ana

To unsubscribe from this group and stop receiving emails from it, send an email to po...@googlegroups.com.

To post to this group, send email to po...@googlegroups.com.
amova pegas results.png

Zhian Kamvar

unread,
Mar 17, 2020, 11:03:24 AM3/17/20
to ana tiburcia, poppr
Hello Ana,

Your results show zero degrees of freedom for city. Do you need to flip the hierarchical relationship to be City/Host?

Best,
Zhian

To unsubscribe from this group and stop receiving emails from it, send an email to poppr+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/poppr/ce31c271-09bd-4f1a-93b9-5e0c6f7125e2%40googlegroups.com.
<amova pegas results.png>

ana tiburcia

unread,
Mar 17, 2020, 2:48:09 PM3/17/20
to poppr

Hello Zhian, 

I change the hierarchical relationship to be City/Host and i found the same results. 

thanks for help,

Ana

Em terça-feira, 17 de março de 2020 11:03:24 UTC-4, Zhian Kamvar escreveu:
Hello Ana,

Your results show zero degrees of freedom for city. Do you need to flip the hierarchical relationship to be City/Host?

Best,
Zhian

To unsubscribe from this group and stop receiving emails from it, send an email to po...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/poppr/ce31c271-09bd-4f1a-93b9-5e0c6f7125e2%40googlegroups.com.
<amova pegas results.png>

Zhian Kamvar

unread,
Mar 17, 2020, 6:16:54 PM3/17/20
to ana tiburcia, poppr
Hello Ana,

The only other thing that I can think would cause this is if one of your strata has only one level. Check to make sure there are at least two levels in "City" if not, discard it from the AMOVA analysis because it is not needed.

Best,
Zhian

To unsubscribe from this group and stop receiving emails from it, send an email to poppr+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/poppr/1a89e3fe-525b-4f07-ab56-d80f86e2235a%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages