<p>I have not really seen this type of plot used when a binary outcome is being analyzed. I think in part this is due to the fact that the plot will be rather boring and difficult to interpret as there are only a limited set of possible values (4 if the response and independent variable are both binary), and without introducing some level of random noise, all of the data observations with the same X-Y value pair would overlap.</p>
<p>The situation is a little better when the independent variable is continuous: then you can show more of a distribution. In the figure below, pulled from Figure 2 of <a href="https://pubmed.ncbi.nlm.nih.gov/20641144/" rel="nofollow noreferrer">this paper</a> explaining how to visualize the discrimination abilities of a logistic regression model, the authors have plotted the risk score produced by the logistic regression model for each patient (x-axis) with the patient's actual outcome on the y-axis. Note that some random noise has been introduced to each observation's y-value so that they do not cover up each other. This plot shows that the risk score is able to somewhat separate the two outcomes.</p>
<p><a href="https://i.sstatic.net/3DGGC.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/3DGGC.png" alt="enter image description here" /></a></p>
<p>If you are dealing with a categorical independent variable like the figure included in your question, I think it is better to visualize the proportion of the outcome for each independent variable category like this:</p>
<p><a href="https://i.sstatic.net/HOfGP.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/HOfGP.png" alt="enter image description here" /></a></p>
<p>Here the outcome is whether the borrower defaulted on their loan (1 = yes, 0 = no) and the independent variable is whether they are a student (yes/no). For the y-axis, I have calculated the proportion of loan recipients in each group that defaulted. This could easily be done with GWAS data such as genotype vs whether the patient died of heart disease.</p>
<p>I also suggest you check out <a href="https://stats.stackexchange.com/questions/147721/which-is-the-best-visualization-for-contingency-tables">this answer</a> on how to visualize a contingency table, as the data you are describing (assuming the independent variable stays categorical) is a contingency table.</p>

CC BY-SA 4.0
2022-03-31T10:01:09.353Z
Thank you for the thoughtful answer - that was really helpful!
icedcoffee
CC BY-SA 4.0
2022-03-31T03:47:28.903Z
2022-03-31T03:47:28.903Z
Tomas Bencomo
<p>Within the <a href="https://en.wikipedia.org/wiki/Genome-wide_association_study" rel="nofollow noreferrer">GWAS wikipedia page</a>, you can view the following plot:</p>
<p><a href="https://i.sstatic.net/7jbps.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/7jbps.png" alt="gwas" /></a></p>
<blockquote>
<p>&quot;Illustration of a simulated genotype by phenotype regression for a
single SNP. Each dot represents an individual. A GWAS of a continuous
trait essentially consists of repeating this analysis at each SNP.&quot;</p>
</blockquote>
<p>This is a regression plot showing on the y-axis the phenotype value for a continuous trait. Is it possible to create a similar plot with a binary trait - I can't think what this would look like, or if there is an equivalent plot I could create.</p>

<snp><gwas><logistic-regression>
Regression plot of a continuous trait - is there a binary equivalent?
# Regression plot of a continuous trait - is there a binary equivalent?

(Asked by: username_0 on 2022-03-28)

Within the [GWAS wikipedia page](https://en.wikipedia.org/wiki/Genome-wide_association_study), you can view the following plot:

[![gwas](https://i.sstatic.net/7jbps.png)](https://i.sstatic.net/7jbps.png)

> "Illustration of a simulated genotype by phenotype regression for a
> single SNP. Each dot represents an individual. A GWAS of a continuous
> trait essentially consists of repeating this analysis at each SNP."

This is a regression plot showing on the y-axis the phenotype value for a continuous trait. Is it possible to create a similar plot with a binary trait - I can't think what this would look like, or if there is an equivalent plot I could create.

**Tags:** snp, gwas, logistic-regression

---

## 1 answers

### Answer by username_1 on 2022-03-31. Score: 1 | Accepted answer

I have not really seen this type of plot used when a binary outcome is being analyzed. I think in part this is due to the fact that the plot will be rather boring and difficult to interpret as there are only a limited set of possible values (4 if the response and independent variable are both binary), and without introducing some level of random noise, all of the data observations with the same X-Y value pair would overlap.

The situation is a little better when the independent variable is continuous: then you can show more of a distribution. In the figure below, pulled from Figure 2 of [this paper](https://pubmed.ncbi.nlm.nih.gov/20641144/) explaining how to visualize the discrimination abilities of a logistic regression model, the authors have plotted the risk score produced by the logistic regression model for each patient (x-axis) with the patient's actual outcome on the y-axis. Note that some random noise has been introduced to each observation's y-value so that they do not cover up each other. This plot shows that the risk score is able to somewhat separate the two outcomes.

[![enter image description here](https://i.sstatic.net/3DGGC.png)](https://i.sstatic.net/3DGGC.png)

If you are dealing with a categorical independent variable like the figure included in your question, I think it is better to visualize the proportion of the outcome for each independent variable category like this:

[![enter image description here](https://i.sstatic.net/HOfGP.png)](https://i.sstatic.net/HOfGP.png)

Here the outcome is whether the borrower defaulted on their loan (1 = yes, 0 = no) and the independent variable is whether they are a student (yes/no). For the y-axis, I have calculated the proportion of loan recipients in each group that defaulted. This could easily be done with GWAS data such as genotype vs whether the patient died of heart disease.

I also suggest you check out [this answer](https://stats.stackexchange.com/questions/147721/which-is-the-best-visualization-for-contingency-tables) on how to visualize a contingency table, as the data you are describing (assuming the independent variable stays categorical) is a contingency table.

> **Comments:**
> **username_0**: Thank you for the thoughtful answer - that was really helpful!  

---

