<p>This sounds like a case of <a href="https://en.wikipedia.org/wiki/Simpson%27s_paradox" rel="noreferrer">Simpson's Paradox</a>.  Did you control for fixed effects?
You might also have heterogeneity - there may be different results in developing vs developed countries.</p>
<p>Generally, it's not wise to ignore something interesting in your data, but I defer to the advisor who's familiar with the area. It may be a known phenomenon that isn't interesting to people in the domain anymore.</p>

CC BY-SA 4.0
2021-07-01T01:09:27.287Z
Actually, I did control for group and period-fixed effects and some relevant covariates. FMHO, I do not think it relates to Simpson Paradox because Simpson Paradox happened when the sign flip when you adding some new covariates. But in this case, one subsample has opposite sign to the whole sample's result.
Phil Nguyen
CC BY-SA 4.0
2021-07-01T07:55:01.423Z
@BeautifulMindset no this could be Simpsons paradox, here the additional control you omit would be dummy for being  developing country, of course such dummy would clash with fixed effects, but as Grada recommended you can try to do treatment*developing dummy interaction that will work even with fixed effects, or you can just try to use random effects (if applicable) and then just add the dummy
1muflon1
CC BY-SA 4.0
2021-07-01T08:34:24.387Z
@1muflon1 , so do you mean, normally, my regression is : *y= post * treat  + firm fixed effect + year fixed effect + error term*. Now, I will create a variable calling **developed** equalling to 1 this observation belongs to developed countries. And whether you mean, now, my regression equation is: y= *post * treat * **developed** + firm fixed effect + year fixed effect + error term*
Phil Nguyen
CC BY-SA 4.0
2021-07-01T13:17:16.457Z
@BeautifulMindset no you can leave post*treat there but you can add additionally post*treat*developed, since you still want to also know what is just the treatment effect but in this way you see what is the additional treatment effect for developed (you will have to add this coefficient to just general treatment coefficient to get overall effect on developed)
1muflon1
CC BY-SA 4.0
2021-07-01T21:44:51.673Z
so, @1muflon, so do you mean the coefficients of  post * treat * developed standing for the additional impact of the law on developed countries. What is the purpose of doing so then ? Why we need to have both  post * treat * developed and post * treat  in my regression ?
Phil Nguyen
CC BY-SA 4.0
2021-07-01T21:48:44.683Z
if you have both post x treat and post x treat x developed then beta on post x treat gives you the result conditional on the fact that the treatment effect on developed is different, then to see what the difference is you just look at beta for post x treat x developed. Also what you say is equivalent to what I say, if developing countries exhibit opposite effect to developed then developed must by definition exhibit opposite effect to developing, so you can put either developed = 1 developing= 0 or developed =0 developing = 1, results wont *qualitatively* change, you should set baseline
1muflon1
CC BY-SA 4.0
2021-07-01T21:49:29.263Z
to what you believe is more general case by convention but other than that it does not matter what you set as your baseline
1muflon1
CC BY-SA 4.0
2021-07-01T21:53:45.947Z
@1muflon@, I am sorry but I still not yet got why we need to do that then, I am quite stuck here, knowing the additional impact of developed countries for what reason?. But yeah, I think it is better that I run the regression and ask in a new topic when all the numbers are available. It should be better for drawing a conclusion though, I deem. Thanks so much.
Phil Nguyen
CC BY-SA 4.0
2021-07-01T21:56:44.430Z
@BeautifulMindset ?? Well your question here was: What should we do if the subsample have the opposite results to the general results?

If subsamples have different result, then you should have additional dummies and interaction. For example, if education affects men and women differently then you should not run 2 separate regressions for men or women (except for some special cases), you should add an interaction educ*gender (and of course still have educ itself), allow for different effect between genders
1muflon1
CC BY-SA 4.0
2021-07-01T01:05:49.013Z
2021-07-01T01:05:49.013Z
RegressForward
<p><strong>tldr</strong>: As the other two answers also indicated, there is not necessarily a problem with your results. It might be the case that the two subgroups have different distributions of the covariates. Alternatively, it might be the case that the within group effects of the law are different from the between group effect.</p>
<h3>Joint and separate regressions</h3>
<p>Consider two groups indexed by 0 and 1. Assume that there are <span class="math-container">$k$</span> covariates. The regression on the full subsample can be written as:
<span class="math-container">$$
y = \underbrace{X}_{n \times k} \underbrace{\beta}_{k \times 1} + \varepsilon
$$</span>
The value of the estimator of <span class="math-container">$\beta$</span> is given by:
<span class="math-container">$$
\hat \beta = (X'X)^{-1} X'y
$$</span>
When considering the first subsample, we can condition on group <span class="math-container">$0$</span>:
<span class="math-container">$$
y_0 = X_0\beta_0 + \varepsilon_0
$$</span>
The value of the estimator of <span class="math-container">$\beta_0$</span> is given by:
<span class="math-container">$$
\hat \beta_0 = (X_0'X_0)^{-1}X_0'y_0
$$</span>
Likewise, on the second subsample, we have:
<span class="math-container">$$
y_1 = X_1 \beta_1 + \varepsilon_1
$$</span>
and:
<span class="math-container">$$
\hat \beta_1 = (X_1'X_1)^{-1}X_1'y_1
$$</span>
The estimates <span class="math-container">$\hat \beta, \hat \beta_0$</span> and <span class="math-container">$\hat \beta_1$</span> are related in the following way,
<span class="math-container">$$
\begin{align*}
\hat \beta &amp;= (X'X)^{-1} X'y,\\
&amp;= (X'X)^{-1} X_0'y_0 + (X'X))^{-1}X_1'y_1,\\
&amp;= W_0 \hat \beta_0 + W_1 \hat \beta_1,
\end{align*}
$$</span>
where
<span class="math-container">$$
W_1 = \underbrace{(X'X)^{-1} X_0'X_0}_{k \times k},\\
W_2 = \underbrace{(X'X)^{-1} (X_1'X_1)}_{k \times k}.
$$</span>
One can check that <span class="math-container">$X'X = X_0'X_0 + X_1'X_1$</span> so we see that <span class="math-container">$W_1 + W_2 = I$</span>. This means that the coefficients of the pooled regression are weighted sums of the coefficients of the sub-sample regressions. Notice, however that the weights should not necessarily be non-negative. Also, as <span class="math-container">$W_1$</span> and <span class="math-container">$W_2$</span> are of dimension <span class="math-container">$k \times k$</span>, each coefficient in <span class="math-container">$\hat \beta$</span> is (potentially) a function of  <strong>all</strong> the coefficients in <span class="math-container">$\hat \beta_0$</span> and <span class="math-container">$\hat \beta_1$</span>.</p>
<p>One exception is when the distribution of <span class="math-container">$X_0$</span> and <span class="math-container">$X_1$</span> are identical. Intuitively, this corresponds to the notion that <span class="math-container">$X$</span> is distributed independent of group membership. In this case, <span class="math-container">$X_0'X_0 \approx X_1'X_1$</span>, so <span class="math-container">$W_1$</span> and <span class="math-container">$W_2$</span> are diagonal matrices with on the diagonals the relative sample sizes of the two subgroups. In this case, every coefficient of <span class="math-container">$\hat \beta$</span> is then a weighted average of the corresponding coefficient in <span class="math-container">$\hat \beta_1$</span> and <span class="math-container">$\hat \beta_2$</span>.</p>
<h4>Intuition</h4>
<p>To see the intuition behind above result, consider the picture below. There's 6 data points divided in two groups: the green and blue dots. The within group regressions (red lines) give a negative slope. However, if we run the regression on the entire sample, we get a positive slope (purple line). This is due tot the fact that the second group has both (on average) higher values of <span class="math-container">$x$</span> and higher values of <span class="math-container">$y$</span>, that overturn the negative within group association.</p>
<p><a href="https://i.sstatic.net/Z3hVI.png" rel="noreferrer"><img src="https://i.sstatic.net/Z3hVI.png" alt="intuition" /></a></p>
<p>As an example consider the association between firm wages and employment and assume that you have a sample across different sectors. It is possible that within each sector there could be a negative association (as higher wages may lead to less profits). However, it might also be the case that across sectors, there is a positive relationship: as more profitable sectors pay higher wages.</p>
<h4>Your case</h4>
<p>In your case, you have group fixed effects for the joint regression. Putting joint fixed effects is the same as subtracting from both <span class="math-container">$y$</span> and <span class="math-container">$L$</span> (the law variable) the within group mean of these variables. As such, for these normalized variables, say <span class="math-container">$\bar y$</span> and <span class="math-container">$\bar L$</span>,  you have the joint regression:
<span class="math-container">$$
\bar y = \beta \bar L + \varepsilon
$$</span>
and the group specific regressions (without intercept as the variables are de-meaned):
<span class="math-container">$$
\bar y_0 = \beta_0 \bar L_0 + \varepsilon_0,\\
\bar y_1 = \beta_1 \bar L_1 + \varepsilon_1
$$</span>
The estimates are given by:
<span class="math-container">$$
\begin{align*}
&amp;\hat \beta = \frac{\bar L'\bar y}{\bar L'\bar L},\\
&amp;\hat \beta_0 = \frac{\bar L_0' \bar y_0}{\bar L_0' \bar L_0},\\
&amp;\hat \beta_1 = \frac{\bar L_1' \bar y_1}{\bar L_1' \bar L_1}.
\end{align*}
$$</span>
Then:
<span class="math-container">$$
\begin{align*}
\hat \beta &amp;= \frac{\bar L_0' \bar y_0 + \bar L_1'\bar y_1}{\bar L'\bar L},\\
&amp;= \hat \beta_0 \underbrace{\frac{\bar L_0'\bar L_0}{\bar L' \bar L}}_{w_0} + \beta_1 \underbrace{\frac{\bar L_1' \bar L_1}{\bar L' \bar L}}_{w_1},\\
&amp;= \hat \beta_0 \frac{n_0 p_0(1-p_0)}{n_0 p_0(1-p_0) + n_1 p_1(1-p_1)} + \hat \beta_1 \frac{n_1 p_1(1-p_1)}{n_0 p_0(1-p_0) + n_1 p_1(1-p_1)}
\end{align*}
$$</span>
where <span class="math-container">$n_0$</span> and <span class="math-container">$n_1$</span> are the subgroup sample sizes and <span class="math-container">$p_0$</span> and <span class="math-container">$p_1$</span> are the fraction of treated observations within each subgroup.</p>
<p>We see that both <span class="math-container">$w_0$</span> and <span class="math-container">$w_1$</span> are non-negative, so <span class="math-container">$\hat \beta$</span> is a weighted average of <span class="math-container">$\hat \beta_0$</span> and <span class="math-container">$\hat \beta_1$</span>. However, it is still possible that one of the two is negative and the other is positive.</p>
<p>If both groups are equal size, then the group with the largest variance (in <span class="math-container">$L$</span>) will have the largest weight. If both group have the same variance, then the group with the largest number of observations will have the largest weight.</p>

CC BY-SA 4.0
2021-07-01T21:50:07.553Z
an amazing work for explaining, @tdm, I totally and really appreciated it, but I am looking for a solution. I understand more from your dedicated explanation. Many thanks and warm regards.
Phil Nguyen
CC BY-SA 4.0
2021-07-02T22:28:11.747Z
Hi @tdm, can I ask where $W_1 + W_2 = I$ coming from ? What does $I$ mean ?
Phil Nguyen
CC BY-SA 4.0
2021-07-02T22:54:15.390Z
And can I ask what do the "***the fraction of treated observations within each subgroup***" mean?
Phil Nguyen
CC BY-SA 4.0
2021-07-03T12:39:44.827Z
@BeautifulMindset Assume that there are $n_1$ observations in subgroup $1$ and $m_1$ have the law implemented (i.e. have the value $L = 1$). Then the fraction of treated observations in subgroup 1 is $\frac{m_1}{n_1}$
tdm
CC BY-SA 4.0
2021-07-01T11:26:08.167Z
2021-07-01T11:26:08.167Z
tdm
<p>I'd interact the regressor you are interested in with a dummy for the country being developed and see what happens. Its entirely possible that the mechanisms at play in developed contries are different from those in the rest of the world. Depending on what your goal is you might satisfy yourself with the observation that the effects are different for the two groups of countries or you might think about modelling the transmission mechanism explicitely.</p>

CC BY-SA 4.0
2021-07-01T08:35:14.300Z
Is there any reference for this way of testing, may I ask ?
Phil Nguyen
CC BY-SA 4.0
2021-07-01T11:33:57.990Z
@BeautifulMindset, you have two dummies - legistation - {yes, no} and developed - {yes, no}, the product of the two dummies is also a dummy. Its one if both are yes. The value of the of the coefficient on that dummy is the difference between (yes, yes) and (legislation = yes, developed = no), as you do net include the developed dummy in he regression in its own. It is tested by just adding the interaction to the regression equation for exmaple in R you would add "+legislation:developed" to the formula object
Grada Gukovic
CC BY-SA 4.0
2021-07-01T05:52:43.567Z
2021-07-01T05:52:43.567Z
Grada Gukovic
<p>In my replication study, I examine whether a law (a law implemented staggered by different countries) has an impact on firms' cash equivalents. The result turning out for the whole sample is that the firms' cash equivalents <strong>decrease</strong> after this law.</p>
<p>However, when I subsample the data by developed and developing countries, the result is funny. It shows that in developed countries, cash equivalents <strong>increase</strong> while in developing countries, cash equivalents decrease.</p>
<p>Did you face the same problem before, what do you normally do to solve this things. My senior friend told me it is a kind of paradox, it is better that we ignore this kind of subsample. Their argument is that the subsample should present the same direction with the whole sample.</p>
<p>I did control for group and period-fixed effects and some relevant covariates</p>
<p>Update: For the benefit of readers, I recommend you to read all the answers and comments because they are all really valuable.</p>

CC BY-SA 4.0
2021-07-02T15:34:19.810Z
You have meet the https://en.wikipedia.org/wiki/Simpson%27s_paradox . You might be interested in this answer http://stats.stackexchange.com/questions/185047/is-this-simpsons-paradox-on-the-titanic-data-set in statistics SE.
Pere
<econometrics><regression><international-economics>
What should we do if the subsample have the opposite results to the general results?
Phil Nguyen
# What should we do if the subsample have the opposite results to the general results?

(Asked by: username_0 on 2021-06-30)

In my replication study, I examine whether a law (a law implemented staggered by different countries) has an impact on firms' cash equivalents. The result turning out for the whole sample is that the firms' cash equivalents **decrease** after this law.

However, when I subsample the data by developed and developing countries, the result is funny. It shows that in developed countries, cash equivalents **increase** while in developing countries, cash equivalents decrease.

Did you face the same problem before, what do you normally do to solve this things. My senior friend told me it is a kind of paradox, it is better that we ignore this kind of subsample. Their argument is that the subsample should present the same direction with the whole sample.

I did control for group and period-fixed effects and some relevant covariates

Update: For the benefit of readers, I recommend you to read all the answers and comments because they are all really valuable.

**Tags:** econometrics, regression, international-economics

> **Comments:**
> **username_1**: You have meet the https://en.wikipedia.org/wiki/Simpson%27s_paradox . You might be interested in this answer http://stats.stackexchange.com/questions/185047/is-this-simpsons-paradox-on-the-titanic-data-set in statistics SE.  

---

## 3 answers

### Answer by username_5 on 2021-07-01. Score: 5 | Accepted answer

I'd interact the regressor you are interested in with a dummy for the country being developed and see what happens. Its entirely possible that the mechanisms at play in developed contries are different from those in the rest of the world. Depending on what your goal is you might satisfy yourself with the observation that the effects are different for the two groups of countries or you might think about modelling the transmission mechanism explicitely.

> **Comments:**
> **username_0**: Is there any reference for this way of testing, may I ask ?  
> **username_5**: @BeautifulMindset, you have two dummies - legistation - {yes, no} and developed - {yes, no}, the product of the two dummies is also a dummy. Its one if both are yes. The value of the of the coefficient on that dummy is the difference between (yes, yes) and (legislation = yes, developed = no), as you do net include the developed dummy in he regression in its own. It is tested by just adding the interaction to the regression equation for exmaple in R you would add "+legislation:developed" to the formula object  

---

### Answer by username_2 on 2021-07-01. Score: 7

This sounds like a case of [Simpson's Paradox](https://en.wikipedia.org/wiki/Simpson%27s_paradox). Did you control for fixed effects?
You might also have heterogeneity - there may be different results in developing vs developed countries.

Generally, it's not wise to ignore something interesting in your data, but I defer to the advisor who's familiar with the area. It may be a known phenomenon that isn't interesting to people in the domain anymore.

> **Comments:**
> **username_0**: Actually, I did control for group and period-fixed effects and some relevant covariates. FMHO, I do not think it relates to Simpson Paradox because Simpson Paradox happened when the sign flip when you adding some new covariates. But in this case, one subsample has opposite sign to the whole sample's result.  
> **username_3**: @BeautifulMindset no this could be Simpsons paradox, here the additional control you omit would be dummy for being  developing country, of course such dummy would clash with fixed effects, but as username_5 recommended you can try to do treatment*developing dummy interaction that will work even with fixed effects, or you can just try to use random effects (if applicable) and then just add the dummy  
> **username_0**: @username_3 , so do you mean, normally, my regression is : *y= post * treat  + firm fixed effect + year fixed effect + error term*. Now, I will create a variable calling **developed** equalling to 1 this observation belongs to developed countries. And whether you mean, now, my regression equation is: y= *post * treat * **developed** + firm fixed effect + year fixed effect + error term*  
> **username_3**: @BeautifulMindset no you can leave post*treat there but you can add additionally post*treat*developed, since you still want to also know what is just the treatment effect but in this way you see what is the additional treatment effect for developed (you will have to add this coefficient to just general treatment coefficient to get overall effect on developed)  
> **username_0**: so, @1muflon, so do you mean the coefficients of  post * treat * developed standing for the additional impact of the law on developed countries. What is the purpose of doing so then ? Why we need to have both  post * treat * developed and post * treat  in my regression ?  
> **username_3**: if you have both post x treat and post x treat x developed then beta on post x treat gives you the result conditional on the fact that the treatment effect on developed is different, then to see what the difference is you just look at beta for post x treat x developed. Also what you say is equivalent to what I say, if developing countries exhibit opposite effect to developed then developed must by definition exhibit opposite effect to developing, so you can put either developed = 1 developing= 0 or developed =0 developing = 1, results wont *qualitatively* change, you should set baseline  
> **username_3**: to what you believe is more general case by convention but other than that it does not matter what you set as your baseline  
> **username_0**: @1muflon@, I am sorry but I still not yet got why we need to do that then, I am quite stuck here, knowing the additional impact of developed countries for what reason?. But yeah, I think it is better that I run the regression and ask in a new topic when all the numbers are available. It should be better for drawing a conclusion though, I deem. Thanks so much.  
> **username_3**: @BeautifulMindset ?? Well your question here was: What should we do if the subsample have the opposite results to the general results?  If subsamples have different result, then you should have additional dummies and interaction. For example, if education affects men and women differently then you should not run 2 separate regressions for men or women (except for some special cases), you should add an interaction educ*gender (and of course still have educ itself), allow for different effect between genders  

---

### Answer by username_4 on 2021-07-01. Score: 6

**tldr**: As the other two answers also indicated, there is not necessarily a problem with your results. It might be the case that the two subgroups have different distributions of the covariates. Alternatively, it might be the case that the within group effects of the law are different from the between group effect.

### Joint and separate regressions

Consider two groups indexed by 0 and 1. Assume that there are $k$ covariates. The regression on the full subsample can be written as:
$$
y = \underbrace{X}\_{n \times k} \underbrace{\beta}\_{k \times 1} + \varepsilon
$$
The value of the estimator of $\beta$ is given by:
$$
\hat \beta = (X'X)^{-1} X'y
$$
When considering the first subsample, we can condition on group $0$:
$$
y\_0 = X\_0\beta\_0 + \varepsilon\_0
$$
The value of the estimator of $\beta\_0$ is given by:
$$
\hat \beta\_0 = (X\_0'X\_0)^{-1}X\_0'y\_0
$$
Likewise, on the second subsample, we have:
$$
y\_1 = X\_1 \beta\_1 + \varepsilon\_1
$$
and:
$$
\hat \beta\_1 = (X\_1'X\_1)^{-1}X\_1'y\_1
$$
The estimates $\hat \beta, \hat \beta\_0$ and $\hat \beta\_1$ are related in the following way,
$$
\begin{align\*}
\hat \beta &= (X'X)^{-1} X'y,\\
&= (X'X)^{-1} X\_0'y\_0 + (X'X))^{-1}X\_1'y\_1,\\
&= W\_0 \hat \beta\_0 + W\_1 \hat \beta\_1,
\end{align\*}
$$
where
$$
W\_1 = \underbrace{(X'X)^{-1} X\_0'X\_0}\_{k \times k},\\
W\_2 = \underbrace{(X'X)^{-1} (X\_1'X\_1)}\_{k \times k}.
$$
One can check that $X'X = X\_0'X\_0 + X\_1'X\_1$ so we see that $W\_1 + W\_2 = I$. This means that the coefficients of the pooled regression are weighted sums of the coefficients of the sub-sample regressions. Notice, however that the weights should not necessarily be non-negative. Also, as $W\_1$ and $W\_2$ are of dimension $k \times k$, each coefficient in $\hat \beta$ is (potentially) a function of **all** the coefficients in $\hat \beta\_0$ and $\hat \beta\_1$.

One exception is when the distribution of $X\_0$ and $X\_1$ are identical. Intuitively, this corresponds to the notion that $X$ is distributed independent of group membership. In this case, $X\_0'X\_0 \approx X\_1'X\_1$, so $W\_1$ and $W\_2$ are diagonal matrices with on the diagonals the relative sample sizes of the two subgroups. In this case, every coefficient of $\hat \beta$ is then a weighted average of the corresponding coefficient in $\hat \beta\_1$ and $\hat \beta\_2$.

#### Intuition

To see the intuition behind above result, consider the picture below. There's 6 data points divided in two groups: the green and blue dots. The within group regressions (red lines) give a negative slope. However, if we run the regression on the entire sample, we get a positive slope (purple line). This is due tot the fact that the second group has both (on average) higher values of $x$ and higher values of $y$, that overturn the negative within group association.

[![intuition](https://i.sstatic.net/Z3hVI.png)](https://i.sstatic.net/Z3hVI.png)

As an example consider the association between firm wages and employment and assume that you have a sample across different sectors. It is possible that within each sector there could be a negative association (as higher wages may lead to less profits). However, it might also be the case that across sectors, there is a positive relationship: as more profitable sectors pay higher wages.

#### Your case

In your case, you have group fixed effects for the joint regression. Putting joint fixed effects is the same as subtracting from both $y$ and $L$ (the law variable) the within group mean of these variables. As such, for these normalized variables, say $\bar y$ and $\bar L$, you have the joint regression:
$$
\bar y = \beta \bar L + \varepsilon
$$
and the group specific regressions (without intercept as the variables are de-meaned):
$$
\bar y\_0 = \beta\_0 \bar L\_0 + \varepsilon\_0,\\
\bar y\_1 = \beta\_1 \bar L\_1 + \varepsilon\_1
$$
The estimates are given by:
$$
\begin{align\*}
&\hat \beta = \frac{\bar L'\bar y}{\bar L'\bar L},\\
&\hat \beta\_0 = \frac{\bar L\_0' \bar y\_0}{\bar L\_0' \bar L\_0},\\
&\hat \beta\_1 = \frac{\bar L\_1' \bar y\_1}{\bar L\_1' \bar L\_1}.
\end{align\*}
$$
Then:
$$
\begin{align\*}
\hat \beta &= \frac{\bar L\_0' \bar y\_0 + \bar L\_1'\bar y\_1}{\bar L'\bar L},\\
&= \hat \beta\_0 \underbrace{\frac{\bar L\_0'\bar L\_0}{\bar L' \bar L}}\_{w\_0} + \beta\_1 \underbrace{\frac{\bar L\_1' \bar L\_1}{\bar L' \bar L}}\_{w\_1},\\
&= \hat \beta\_0 \frac{n\_0 p\_0(1-p\_0)}{n\_0 p\_0(1-p\_0) + n\_1 p\_1(1-p\_1)} + \hat \beta\_1 \frac{n\_1 p\_1(1-p\_1)}{n\_0 p\_0(1-p\_0) + n\_1 p\_1(1-p\_1)}
\end{align\*}
$$
where $n\_0$ and $n\_1$ are the subgroup sample sizes and $p\_0$ and $p\_1$ are the fraction of treated observations within each subgroup.

We see that both $w\_0$ and $w\_1$ are non-negative, so $\hat \beta$ is a weighted average of $\hat \beta\_0$ and $\hat \beta\_1$. However, it is still possible that one of the two is negative and the other is positive.

If both groups are equal size, then the group with the largest variance (in $L$) will have the largest weight. If both group have the same variance, then the group with the largest number of observations will have the largest weight.

> **Comments:**
> **username_0**: an amazing work for explaining, @username_4, I totally and really appreciated it, but I am looking for a solution. I understand more from your dedicated explanation. Many thanks and warm regards.  
> **username_0**: Hi @username_4, can I ask where $W_1 + W_2 = I$ coming from ? What does $I$ mean ?  
> **username_0**: And can I ask what do the "***the fraction of treated observations within each subgroup***" mean?  
> **username_4**: @BeautifulMindset Assume that there are $n_1$ observations in subgroup $1$ and $m_1$ have the law implemented (i.e. have the value $L = 1$). Then the fraction of treated observations in subgroup 1 is $\frac{m_1}{n_1}$  

---

