text: user12238: I have conducted a large-scale GWAS study and got a few significantly associated SNPs. I used GEMMA with -lmm 1 options to run the GWAS and obtain the beta and standard-error estimates. I want to estimate the percent phenotypic variation explained by each of the significant SNPs. I used the following procedure for estimating the variance explained in R:
  fit <- lm (Phenotypic_value ~ SNP_data, data = a)
  summary(fit)$adj.r.squared
  
  Here, the datafile a contains three columns namely, sample_ID, Phenotypic_value for each sample, and the biallelic SNP_data. I got a value which is 0.43 meaning 43% phenotypic variation explained by the SNP.
  Again, I used another formula which is: 2*f*(1-f)*b.alt^2. Here, f is the minor allele frequency and b.alt is the effect size i.e. beta estimate obtained from GEMMA. This gives me a value of 0.03 meaning 3% variation explained which seems reasonable to me.
  My question is that which of the above method is correct? Why do I obtain such a huge difference between the two approaches? Is there any other way to estimate the percent variation explained?
  Alternatively, from the GEMMA google group, I have got this formula pve <- var(x) * (beta^2 + se^2)/var(y). But I do not understand how can I obtain the value of var(x) and var(y).
  I borrowed the first and the last formula from GEMMA google group discussion. The first one is obviously a normal linear model equation in statistics. The second formula is from link. Also, the data structure is three columns, 1 is with individual, 2 is the genetic information (individual carrying A or T) and 3 is the phenotype.
  In the last formula, var(x) is the variance of the genotype vector as they said in GEMMA group and the beta is the effect size estimate and se is the standard error from GEMMA output.
  It will be great to receive some feedback on this. Thank you.
  
  user73: Answer from @maximilian-press, converted from comment:
  At a guess, the GEMMA linear mixed model is controlling for population structure and other SNPs, which your R example is not (it only fits 1 SNP?), but it's hard to be sure with this information. It would be helpful to see data samples. There is probably more context and usage information available in those resources beyond just the equations. It is especially difficult to evaluate with no terms defined as in your last example (defining the terms in the earlier ones is a good start).
  
original_text: 12238: <p>I have conducted a large-scale GWAS study and got a few significantly associated SNPs. I used <code>GEMMA</code> with <code>-lmm 1</code> options to run the GWAS and obtain the <code>beta</code> and <code>standard-error</code> estimates. I want to estimate the percent phenotypic variation explained by each of the significant SNPs. I used the following procedure for estimating the variance explained in <code>R</code>:</p>
  <pre><code>fit &lt;- lm (Phenotypic_value ~ SNP_data, data = a)
  summary(fit)$adj.r.squared
  </code></pre>
  <p>Here, the datafile <code>a</code> contains three columns namely, <code>sample_ID</code>, <code>Phenotypic_value</code> for each sample, and the biallelic <code>SNP_data</code>. I got a value which is 0.43 meaning 43% phenotypic variation explained by the SNP.</p>
  <p>Again, I used another formula which is: <code>2*f*(1-f)*b.alt^2</code>. Here, <code>f</code> is the minor allele frequency and <code>b.alt</code> is the effect size i.e. <code>beta estimate</code> obtained from <code>GEMMA</code>. This gives me a value of 0.03 meaning 3% variation explained which seems reasonable to me.</p>
  <p>My question is that which of the above method is correct? Why do I obtain such a huge difference between the two approaches? Is there any other way to estimate the percent variation explained?</p>
  <p>Alternatively, from the GEMMA google group, I have got this formula <code>pve &lt;- var(x) * (beta^2 + se^2)/var(y)</code>. But I do not understand how can I obtain the value of <code>var(x)</code> and <code>var(y)</code>.</p>
  <p>I borrowed the first and the last formula from GEMMA google group discussion. The first one is obviously a normal linear model equation in statistics. The second formula is from <a href="https://www.mv.helsinki.fi/home/mjxpirin/GWAS_course/material/GWAS3.html" rel="nofollow noreferrer">link</a>. Also, the data structure is three columns, 1 is with individual, 2 is the genetic information (individual carrying A or T) and 3 is the phenotype.
  In the last formula, <code>var(x)</code> is the variance of the genotype vector as they said in GEMMA group and the <code>beta</code> is the effect size estimate and <code>se</code> is the standard error from GEMMA output.</p>
  <p>It will be great to receive some feedback on this. Thank you.</p>
   73: <p><em>Answer from @maximilian-press, converted from comment:</em></p>
  <p>At a guess, the GEMMA linear mixed model is controlling for population structure and other SNPs, which your R example is not (it only fits 1 SNP?), but it's hard to be sure with this information. It would be helpful to see data samples. There is probably more context and usage information available in those resources beyond just the equations. It is especially difficult to evaluate with no terms defined as in your last example (defining the terms in the earlier ones is a good start).</p>
  