Answers.Body: <p>Instead of the "observed phenotype", it's asking for a "corrected phenotype", which is the residuals from <code>pheno ~ covariates</code>. In R, one would get that as follows:</p>
  
  <pre><code>fit = lm(phenotype ~ covariates, data)
  corrected_phenotype = resid(fit)
  </code></pre>
  
  <p>Of course <code>covariates</code> is just a place hold for something like <code>age + gender</code> or something along those lines.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-25T14:45:06.890Z
Answers.Text: Hi @Devon Ryan, I have a question regarding phenotype. Will you be able to help. only if you have time. Else you can ignore it. https://bioinformatics.stackexchange.com/questions/11028/use-of-electronic-phenotype-in-ehr
Answers.UserDisplayName: The Great
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-05T18:49:25.670Z
Answers.LastActivityDate: 2017-09-05T18:49:25.670Z
Answers.UserDisplayName: Devon Ryan
Body: <p>I'm trying to use the bfGWAS tool, which analyses GWAS data and integrates functional annotations to identify casual SNPs (<a href="http://www.cell.com/ajhg/fulltext/S0002-9297(17)30324-5" rel="noreferrer">paper</a> and 
  <a href="https://github.com/yjingj/bfGWAS" rel="noreferrer">github</a>). In the user manual, it states:</p>
  
  <blockquote>
    <p>We recommend first regressing covariants out from the original
    phenotypes, and then provide bfGWAS the corrected phenotypes (i.e.,
    residuals from the regression model with covariates).</p>
  </blockquote>
  
  <p>It is unclear to me what this means and how to go about determining the corrected phenotypes. Typically, in an association test with covariates, a regression would be performed using a model like</p>
  
  <pre><code>pheno ~ snp + covariate 
  </code></pre>
  
  <p>I could then get the residuals from this model. However, I'm not certain how to go about it for all SNPs, and then adjust the phenotypes. I have case-control data, so the phenotypes are binary.</p>
  
Tags: <r><gwas>
Title: Adjusting phenotypes by regressing out covariates
ThreadText: # Adjusting phenotypes by regressing out covariates
  
  (Asked by: username_0 on 2017-09-05)
  
  I'm trying to use the bfGWAS tool, which analyses GWAS data and integrates functional annotations to identify casual SNPs ([paper](http://www.cell.com/ajhg/fulltext/S0002-9297(17)30324-5) and
  [github](https://github.com/yjingj/bfGWAS)). In the user manual, it states:
  
  > We recommend first regressing covariants out from the original
  > phenotypes, and then provide bfGWAS the corrected phenotypes (i.e.,
  > residuals from the regression model with covariates).
  
  It is unclear to me what this means and how to go about determining the corrected phenotypes. Typically, in an association test with covariates, a regression would be performed using a model like
  
  ```
  pheno ~ snp + covariate 
  
  ```
  
  I could then get the residuals from this model. However, I'm not certain how to go about it for all SNPs, and then adjust the phenotypes. I have case-control data, so the phenotypes are binary.
  
  **Tags:** r, gwas
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-09-05. Score: 2 | Accepted answer
  
  Instead of the "observed phenotype", it's asking for a "corrected phenotype", which is the residuals from `pheno ~ covariates`. In R, one would get that as follows:
  
  ```
  fit = lm(phenotype ~ covariates, data)
  corrected_phenotype = resid(fit)
  
  ```
  
  Of course `covariates` is just a place hold for something like `age + gender` or something along those lines.
  
  > **Comments:**
  > **username_2**: Hi @username_1, I have a question regarding phenotype. Will you be able to help. only if you have time. Else you can ignore it. https://bioinformatics.stackexchange.com/questions/11028/use-of-electronic-phenotype-in-ehr  
  
  ---
  
  