<p>I'm a bioinformatician, but not a statistician, and it's been a while since I did any <span class="math-container">$\chi^2$</span> tests, so take this answer with a grain of salt.</p>
<p>From what I remember, the most important thing is to be clear about what your observed and expected values are, and to be consistent. In other words, <em><strong>it doesn't matter what you pick, as long as you make it clear what you've picked</strong></em>. For your situation there are at least four possible &quot;expected&quot; values that can be used:</p>
<ol>
<li>Average counts based on your available data (this is probably the most commonly used approach)</li>
<li>Equal proportions based on your available data (this is less common, because it alters table totals)</li>
<li>Unaffected sib counts (also less common, because it alters totals)</li>
<li>Population average counts based on public data</li>
</ol>
<p>Unfortunately, there's no answer that will work for all situations. It's a good idea to think about which of these (or any others) makes sense in your particular case, what you're actually trying to compare, and how much you want to generalise to other populations. It's almost always the case that you know your own data better than anybody else, so are in the best position to make this decision. For example, if this is a very rare variant in the general population, you might choose to look for general population data for the variant, but if you're only interested in the impact of people who are aware of a family history, then unaffected sibs might be a better approach.</p>
<p>In any case, the calculations for generating the expected values are similar: work out the proportion of the variant in the expected population, and apply that proportion to the total count in the observed population.</p>
<p>In the first case, the expected counts would be something like this [note that the table totals are preserved]:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="text-align: left;"></th>
<th style="text-align: right;">Denovo</th>
<th style="text-align: right;">WT</th>
<th style="text-align: right;">Total</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">Proband</td>
<td style="text-align: right;">*604.2</td>
<td style="text-align: right;">1150.8</td>
<td style="text-align: right;">1755</td>
</tr>
<tr>
<td style="text-align: left;">Unaffected sibs</td>
<td style="text-align: right;">453.8</td>
<td style="text-align: right;">864.2</td>
<td style="text-align: right;">1318</td>
</tr>
<tr>
<td style="text-align: left;"><strong>Total</strong></td>
<td style="text-align: right;">1058</td>
<td style="text-align: right;">2015</td>
<td style="text-align: right;">3073</td>
</tr>
</tbody>
</table>
</div>
<p>* calculation: row total (1755) as a proportion of full total (3073) = 0.5711, which is then multiplied by the column total (1058) = 604.2</p>
<p>In the second case, it would be this [note that the row totals are different]:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="text-align: left;"></th>
<th style="text-align: right;">Denovo</th>
<th style="text-align: right;">WT</th>
<th style="text-align: right;">Total</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">Proband</td>
<td style="text-align: right;">529</td>
<td style="text-align: right;">1007.5</td>
<td style="text-align: right;">1536.5</td>
</tr>
<tr>
<td style="text-align: left;">Unaffected sibs</td>
<td style="text-align: right;">529</td>
<td style="text-align: right;">1007.5</td>
<td style="text-align: right;">1536.5</td>
</tr>
<tr>
<td style="text-align: left;"><strong>Total</strong></td>
<td style="text-align: right;">1058</td>
<td style="text-align: right;">2015</td>
<td style="text-align: right;">3073</td>
</tr>
</tbody>
</table>
</div>
<p>In the third case, it's simply comparing Proband vs Unaffected counts, normalising based on the row total:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="text-align: left;"></th>
<th style="text-align: right;">Denovo</th>
<th style="text-align: right;">WT</th>
<th style="text-align: right;">Total</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">Proband</td>
<td style="text-align: right;">672.4</td>
<td style="text-align: right;">1082.6</td>
<td style="text-align: right;">1755</td>
</tr>
<tr>
<td style="text-align: left;">Unaffected sibs</td>
<td style="text-align: right;">505</td>
<td style="text-align: right;">813</td>
<td style="text-align: right;">1318</td>
</tr>
<tr>
<td style="text-align: left;"><strong>Total</strong></td>
<td style="text-align: right;">1177.4</td>
<td style="text-align: right;">1895.6</td>
<td style="text-align: right;">3073</td>
</tr>
</tbody>
</table>
</div>
<p>Note that the second row can be omitted from <span class="math-container">$\chi^2$</span> calculations here, because it's <em>identical</em> to the expected values, so adding that difference will not change the calculated <span class="math-container">$\chi^2$</span> sum.</p>
<p>[this could also be done based on the column total, if you wanted to compare Denovo vs WT, instead of Proband vs Unaffected]</p>

CC BY-SA 4.0
2022-10-13T12:27:37.550Z
2022-10-13T12:27:37.550Z
gringer
<p>It seems reasonable, it depends how you do the Chi2.</p>
<p>The Chi2 distribution depends on a good estimate of the expected (E). Here your observed (O) is the &quot;affecteds&quot; and you want to assess whether this has a suspected elevated  mutation rate, then that looks a meaningful measure.
There's two approaches</p>
<ol>
<li>Your E is the unaffected siblings and E is calculated by averaging this value. You could also perform the reverse calculation where E was the average for the affecteds and O is the unaffected. There will be an issue about the degrees of freedom, which would require some thought.</li>
<li>There is an alternative way to perform Chi2, which I forget because O and E are matched (both siblings), here there is no averaging. You'd need to look it up, the numerator is the summed difference for each sibling group ... but I can't remember.</li>
</ol>
<p>Point 2 would be a good test, but you'd need to check the test.</p>
<p>A phylogeneticist would also use the Chi2 in a very different test. They would draw a tree and designate two rates, one for affected and unaffected. If there was elevated mutation rate in the affected it could be tested on a likelihood ratio test, i.e. the rate of evolution was increased. This can be done because the test tree would be one where the rate was the same between affecteds and unaffected progeny. The way the test works is the likelihood difference between the two trees is assessed and because the number of increased parameters (degrees of freedom) is known and log probabilities can be subtracted from each other and directly assessed (I think its degrees of freedom + 1 ... 1 additional parameter so its 2) - and therefore the difference in likelihood is tested directly against the Chi2. Its kinda neat and exploits the behaviour of log probabilities.</p>

CC BY-SA 4.0
2022-10-11T08:27:13.980Z
2022-10-12T02:57:17.723Z
2022-10-12T02:57:17.723Z
M__
<p>I need some suggestions regarding an analysis. I might be wrong as I have no stats background.</p>
<p>I have list of exon with differential usage across samples. I can find lots of denovo mutations from both proband and siblings in those exons. Now I am trying to check was there any enrichment of proband specific denovo mutations in those exons. I can think of doing a chi square test. But I am not sure what will be expected value in chi square test. Imagine I am having 700 denovo proband mutation in 650 samples out of 1500 probands and 300 denovo mutations in 320 unaffected  siblings, out of 1200. Any suggestions? Thanks</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="text-align: left;"></th>
<th style="text-align: right;">Denovo</th>
<th style="text-align: right;">WT</th>
<th style="text-align: right;">Total</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">Proband</td>
<td style="text-align: right;">553</td>
<td style="text-align: right;">1202</td>
<td style="text-align: right;">1755</td>
</tr>
<tr>
<td style="text-align: left;">Unaffected sibs</td>
<td style="text-align: right;">505</td>
<td style="text-align: right;">813</td>
<td style="text-align: right;">1318</td>
</tr>
<tr>
<td style="text-align: left;"><strong>Total</strong></td>
<td style="text-align: right;">1058</td>
<td style="text-align: right;">2015</td>
<td style="text-align: right;">3073</td>
</tr>
</tbody>
</table>
</div>
CC BY-SA 4.0
2022-10-12T11:23:01.550Z
Hi @user3377241, I tried to convert your numbers into a table, but it seems inconsistent / incomplete. Could you please fill in the table? I think this will help us to understand what's going on.
gringer
CC BY-SA 4.0
2022-10-13T05:57:26.833Z
@gringer I have edited the table with actual numbers. These number are of probands and siblings. The variants number will be different as many a time a proband have multiple events. I am not sure with should be expected value in these calculation. Thanks
user3377241
<r>
Regarding chi square?
# Regarding chi square?

(Asked by: username_0 on 2022-10-11)

I need some suggestions regarding an analysis. I might be wrong as I have no stats background.

I have list of exon with differential usage across samples. I can find lots of denovo mutations from both proband and siblings in those exons. Now I am trying to check was there any enrichment of proband specific denovo mutations in those exons. I can think of doing a chi square test. But I am not sure what will be expected value in chi square test. Imagine I am having 700 denovo proband mutation in 650 samples out of 1500 probands and 300 denovo mutations in 320 unaffected siblings, out of 1200. Any suggestions? Thanks

|  | Denovo | WT | Total |
| --- | --- | --- | --- |
| Proband | 553 | 1202 | 1755 |
| Unaffected sibs | 505 | 813 | 1318 |
| **Total** | 1058 | 2015 | 3073 |

**Tags:** r
> **Comments:**
> **username_1**: Hi @user3377241, I tried to convert your numbers into a table, but it seems inconsistent / incomplete. Could you please fill in the table? I think this will help us to understand what's going on.  
> **username_0**: @gringer I have edited the table with actual numbers. These number are of probands and siblings. The variants number will be different as many a time a proband have multiple events. I am not sure with should be expected value in these calculation. Thanks  

---

## 2 answers

### Answer by username_1 on 2022-10-13. Score: 1 | Accepted answer

I'm a bioinformatician, but not a statistician, and it's been a while since I did any $\chi^2$ tests, so take this answer with a grain of salt.

From what I remember, the most important thing is to be clear about what your observed and expected values are, and to be consistent. In other words, ***it doesn't matter what you pick, as long as you make it clear what you've picked***. For your situation there are at least four possible "expected" values that can be used:

1. Average counts based on your available data (this is probably the most commonly used approach)
2. Equal proportions based on your available data (this is less common, because it alters table totals)
3. Unaffected sib counts (also less common, because it alters totals)
4. Population average counts based on public data

Unfortunately, there's no answer that will work for all situations. It's a good idea to think about which of these (or any others) makes sense in your particular case, what you're actually trying to compare, and how much you want to generalise to other populations. It's almost always the case that you know your own data better than anybody else, so are in the best position to make this decision. For example, if this is a very rare variant in the general population, you might choose to look for general population data for the variant, but if you're only interested in the impact of people who are aware of a family history, then unaffected sibs might be a better approach.

In any case, the calculations for generating the expected values are similar: work out the proportion of the variant in the expected population, and apply that proportion to the total count in the observed population.

In the first case, the expected counts would be something like this [note that the table totals are preserved]:

|  | Denovo | WT | Total |
| --- | --- | --- | --- |
| Proband | \*604.2 | 1150.8 | 1755 |
| Unaffected sibs | 453.8 | 864.2 | 1318 |
| **Total** | 1058 | 2015 | 3073 |

\* calculation: row total (1755) as a proportion of full total (3073) = 0.5711, which is then multiplied by the column total (1058) = 604.2

In the second case, it would be this [note that the row totals are different]:

|  | Denovo | WT | Total |
| --- | --- | --- | --- |
| Proband | 529 | 1007.5 | 1536.5 |
| Unaffected sibs | 529 | 1007.5 | 1536.5 |
| **Total** | 1058 | 2015 | 3073 |

In the third case, it's simply comparing Proband vs Unaffected counts, normalising based on the row total:

|  | Denovo | WT | Total |
| --- | --- | --- | --- |
| Proband | 672.4 | 1082.6 | 1755 |
| Unaffected sibs | 505 | 813 | 1318 |
| **Total** | 1177.4 | 1895.6 | 3073 |

Note that the second row can be omitted from $\chi^2$ calculations here, because it's *identical* to the expected values, so adding that difference will not change the calculated $\chi^2$ sum.

[this could also be done based on the column total, if you wanted to compare Denovo vs WT, instead of Proband vs Unaffected]


---

### Answer by username_2 on 2022-10-11. Score: 1

It seems reasonable, it depends how you do the Chi2.

The Chi2 distribution depends on a good estimate of the expected (E). Here your observed (O) is the "affecteds" and you want to assess whether this has a suspected elevated mutation rate, then that looks a meaningful measure.
There's two approaches

1. Your E is the unaffected siblings and E is calculated by averaging this value. You could also perform the reverse calculation where E was the average for the affecteds and O is the unaffected. There will be an issue about the degrees of freedom, which would require some thought.
2. There is an alternative way to perform Chi2, which I forget because O and E are matched (both siblings), here there is no averaging. You'd need to look it up, the numerator is the summed difference for each sibling group ... but I can't remember.

Point 2 would be a good test, but you'd need to check the test.

A phylogeneticist would also use the Chi2 in a very different test. They would draw a tree and designate two rates, one for affected and unaffected. If there was elevated mutation rate in the affected it could be tested on a likelihood ratio test, i.e. the rate of evolution was increased. This can be done because the test tree would be one where the rate was the same between affecteds and unaffected progeny. The way the test works is the likelihood difference between the two trees is assessed and because the number of increased parameters (degrees of freedom) is known and log probabilities can be subtracted from each other and directly assessed (I think its degrees of freedom + 1 ... 1 additional parameter so its 2) - and therefore the difference in likelihood is tested directly against the Chi2. Its kinda neat and exploits the behaviour of log probabilities.


---

