You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: vignettes/practical_inequalities.Rmd
+23-15Lines changed: 23 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -104,7 +104,11 @@ The plot shows that individuals with higher education report a higher QoL, and t
104
104
105
105
For categorical predictors with only two levels, like low vs. high income groups or male vs. female sex, the absolute inequality is straightforward to compute: it's the difference between the estimated predictions for the two levels (simple pairwise comparison). However, for nominal or ordinal variables with multiple levels, we need to consider all pairwise differences.
106
106
107
-
The advantages of the `modelbased` package become most apparent when working with predictors that have *more than two levels*. In this case, the **absolute inequality** is the average of all absolute differences between the predicted outcomes for each pair of groups. It answers the question: "On average, how many units does the outcome differ between any two education groups?"
107
+
The advantages of the `modelbased` package become most apparent when working with predictors that have *more than two levels*. In this case, the **absolute inequality** is the average of all absolute differences between the predicted outcomes for each pair of groups.
108
+
109
+
It answers the question:
110
+
111
+
> "On average, how many units does the outcome differ between *any two* education groups?"
**Relative inequality** (or the inequality ratio) is the average of the ratios of predicted outcomes between all pairs of groups. It answers the question: "On average, by what factor does the outcome differ between any two education groups?" This is particularly useful when the scale of the outcome is not intrinsically meaningful or when comparing effects across different outcomes.
137
+
**Relative inequality** (or the inequality ratio) is the average of the ratios of predicted outcomes between all pairs of groups.
138
+
139
+
It answers the question:
140
+
141
+
> "On average, by what factor does the outcome differ between *any two* education groups?"
142
+
143
+
This is particularly useful when the scale of the outcome is not intrinsically meaningful or when comparing effects across different outcomes.
134
144
135
145
### Pairwise Ratios
136
146
@@ -273,11 +283,9 @@ estimate_contrasts(
273
283
)
274
284
```
275
285
276
-
<divclass="custom_note">
277
-
<p>
278
-
In the above example, we set `integer_as_continuous = TRUE` to ensure that the time variable is treated as continuous, allowing us to calculate the slope differences correctly. By default, numeric variables with only a few integer values are treated as "discrete" (ordinal-alike), which would rather calculate contrasts for each time point and not the slope of a continuous `time` variable. See also [documentation of `estimate_contrasts()`](https://easystats.github.io/modelbased/reference/estimate_contrasts.html) for more details, especially the `...` argument and the examples.
279
-
</p>
280
-
</div>
286
+
::: custom_note
287
+
<p>In the above example, we set `integer_as_continuous = TRUE` to ensure that the time variable is treated as continuous, allowing us to calculate the slope differences correctly. By default, numeric variables with only a few integer values are treated as "discrete" (ordinal-alike), which would rather calculate contrasts for each time point and not the slope of a continuous `time` variable. See also [documentation of `estimate_contrasts()`](https://easystats.github.io/modelbased/reference/estimate_contrasts.html) for more details, especially the `...` argument and the examples.</p>
288
+
:::
281
289
282
290
The mean difference in slopes is 4.74 in Group 1. This indicates that the rate of change in QoL differs, on average, by 4.74 points per unit of time between any two categories of the education groups. Inequalities are smaller in Group 2 (Mean Difference = 2.88), suggesting a more uniform change over time.
283
291
@@ -304,21 +312,21 @@ Inequalities are calculated by means of *absolute* differences. This means, whil
304
312
305
313
The `modelbased` package offers a powerful and intuitive way to move beyond simple pairwise comparisons and summarize the holistic effect of categorical variables. By quantifying **absolute and relative inequalities**, researchers can:
306
314
307
-
* Obtain a single, interpretable effect size for a nominal or ordinal predictor.
308
-
* Formally test whether this overall effect is statistically significant.
309
-
* Compare the magnitude of inequality across different groups, models, or over time.
315
+
- Obtain a single, interpretable effect size for a nominal or ordinal predictor.
316
+
- Formally test whether this overall effect is statistically significant.
317
+
- Compare the magnitude of inequality across different groups, models, or over time.
310
318
311
319
This approach aligns statistical practice with the theoretical concept of group-based disparities, providing a clearer and more comprehensive understanding of how social categories shape outcomes.
312
320
313
321
## Formula interface
314
322
315
323
The `modelbased` package also allows you to compute these inequalities using a formula interface for the `comparison` argument. The following table summarizes the available options for computing inequalities using the `estimate_contrasts()` function with a formula interface:
Grouping variables are usually specified using the `by` argument. Additionally, these can also be specified in the formula interface, for example, `~inequality | group1` or `inequality ~ pairwise | group1 + group2`.
0 commit comments