Skip to content

Commit 7b2ef13

Browse files
committed
Refactoring tutorial notebooks
1 parent 829f665 commit 7b2ef13

3 files changed

Lines changed: 39 additions & 58 deletions

File tree

nbs/tutorials/04-mini_meta_delta.ipynb

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
"id": "a9ca4dd5",
1818
"metadata": {},
1919
"source": [
20-
"When scientists perform replicates of the same experiment, the effect size of each replicate often varies, which complicates interpretation of the results. As of v2023.02.14, DABEST can now compute the meta-analyzed weighted effect size given multiple replicates of the same experiment. This can help resolve differences between replicates and simplify interpretation.\n",
20+
"When scientists conduct replicates of the same experiment, the effect size of each replicate often varies, complicating the interpretation of the results. Starting from v2023.02.14, DABEST can now compute the meta-analyzed weighted effect size given multiple replicates of the same experiment. This can help resolve differences between replicates and simplify interpretation.\n",
2121
"\n",
22-
"This function uses the generic *inverse-variance* method to calculate the effect size, as follows:\n",
22+
"This function employs the generic *inverse-variance* method to calculate the effect size, as follows:\n",
2323
"\n",
2424
"$\\theta_{\\text{weighted}} = \\frac{\\Sigma\\hat{\\theta_{i}}w_{i}}{{\\Sigma}w_{i}}$\n",
2525
"\n",
@@ -43,9 +43,9 @@
4343
"id": "5fb1dc0f",
4444
"metadata": {},
4545
"source": [
46-
"Note that this uses the *fixed-effects* model of meta-analysis, as opposed to the random-effects model; that is to say, all variation between the results of each replicate is assumed to be due solely to sampling error. We thus recommend that this function only be used for replications of the same experiment, i.e. situations where it can be safely assumed that each replicate estimates the same population mean $\\mu$. \n",
46+
"Note that this utilizes the fixed-effects model of meta-analysis, in contrast to the random-effects model. In the fixed-effects model, all variation between the results of each replicate is assumed to be solely due to sampling error. Therefore, we recommend using this function exclusively for replications of the same experiment, where it can be safely assumed that each replicate estimates the same population mean $\\mu$.\n",
4747
"\n",
48-
"Also note that as of v2023.02.14, DABEST can only compute weighted effect size *for mean difference only*, and not standardized measures such as Cohen's *d*.\n",
48+
"Additionally, be aware that as of v2023.02.14, DABEST can only compute weighted effect size *for mean difference only*, and not for standardized measures such as Cohen's *d*.\n",
4949
"\n",
5050
"For more information on meta-analysis, please refer to Chapter 10 of the Cochrane handbook: https://training.cochrane.org/handbook/current/chapter-10\n"
5151
]
@@ -55,7 +55,7 @@
5555
"id": "12c4d226",
5656
"metadata": {},
5757
"source": [
58-
"## Load Libraries"
58+
"## Load libraries"
5959
]
6060
},
6161
{
@@ -93,7 +93,7 @@
9393
"id": "09a9b692",
9494
"metadata": {},
9595
"source": [
96-
"We will now create a dataset to demonstrate the mini-meta function."
96+
"Let´s create a dataset to demonstrate the mini-meta function."
9797
]
9898
},
9999
{
@@ -139,8 +139,8 @@
139139
"id": "e5b9dbbd",
140140
"metadata": {},
141141
"source": [
142-
"We now have 3 Control and 3 Test groups, simulating 3 replicates of the same experiment. Our\n",
143-
"dataset also has a non-numerical column indicating gender, and another\n",
142+
"We now have three *Control* and three *Test* groups, simulating three replicates of the same experiment. Our\n",
143+
"dataset has also a non-numerical column indicating gender, and another\n",
144144
"column indicating the identity of each observation."
145145
]
146146
},
@@ -274,17 +274,15 @@
274274
"id": "21171074",
275275
"metadata": {},
276276
"source": [
277-
"## Loading Data"
277+
"## Loading data"
278278
]
279279
},
280280
{
281281
"cell_type": "markdown",
282282
"id": "adc6d626",
283283
"metadata": {},
284284
"source": [
285-
"Next, we load data as we would normally using ``dabest.load()``. This time, however,\n",
286-
"we also specify the argument ``mini_meta=True``. As we are loading three experiments' worth of data,\n",
287-
"``idx`` is passed as a tuple of tuples, as follows:"
285+
"Next, we load data as usual using ``dabest.load()``. However, this time, we also specify the argument ``mini_meta=True``. Since we are loading data from three experiments, ``idx`` is passed as a tuple of tuples, as shown below:"
288286
]
289287
},
290288
{
@@ -302,7 +300,7 @@
302300
"id": "1a3bcd5c",
303301
"metadata": {},
304302
"source": [
305-
"When this ``Dabest`` object is called, it should show that effect sizes will be calculated for each group, as well as the weighted delta. Note once again that weighted delta will only be calcuated for mean difference.\n"
303+
"When this ``Dabest`` object is invoked, it should indicate that effect sizes will be calculated for each group, along with the weighted delta. It is important to note once again that the weighted delta will only be calculated for mean differences"
306304
]
307305
},
308306
{
@@ -395,7 +393,7 @@
395393
"id": "0de6f65c",
396394
"metadata": {},
397395
"source": [
398-
"You can view the details of each experiment by accessing `.mean_diff.results`, as follows."
396+
"You can view the details of each experiment by accessing the property `mean_diff.results` as follows."
399397
]
400398
},
401399
{
@@ -606,17 +604,17 @@
606604
"id": "c581f3fa",
607605
"metadata": {},
608606
"source": [
609-
"Note, however, that this does not contain the relevant information for our weighted delta. The details of the weighted delta are stored as attributes of the ``mini_meta_delta`` object, for example:\n",
607+
"Note, however, that this does not contain the relevant information for our weighted delta. The details of the weighted delta are stored as attributes of the ``mini_meta_delta`` object, such as:\n",
610608
"\n",
611-
" - ``group_var``: the pooled group variances of each set of 2 experiment groups\n",
612-
" - ``difference``: the weighted mean difference calculated based on the raw data\n",
613-
" - ``bootstraps``: the deltas of each set of 2 experiment groups calculated based on the bootstraps\n",
614-
" - ``bootstraps_weighted_delta``: the weighted deltas calculated based on the bootstraps\n",
615-
" - ``permutations``: the deltas of each set of 2 experiment groups calculated based on the permutation data\n",
616-
" - ``permutations_var``: the pooled group variances of each set of 2 experiment groups calculated based on permutation data\n",
617-
" - ``permutations_weighted_delta``: the weighted deltas calculated based on the permutation data\n",
609+
" - ``group_var``: the pooled group variances of each set of 2 experiment groups.\n",
610+
" - ``difference``: the weighted mean difference calculated based on the raw data.\n",
611+
" - ``bootstraps``: the deltas of each set of 2 experiment groups calculated based on the bootstraps.\n",
612+
" - ``bootstraps_weighted_delta``: the weighted deltas calculated based on the bootstraps.\n",
613+
" - ``permutations``: the deltas of each set of 2 experiment groups calculated based on the permutation data.\n",
614+
" - ``permutations_var``: the pooled group variances of each set of 2 experiment groups calculated based on permutation data.\n",
615+
" - ``permutations_weighted_delta``: the weighted deltas calculated based on the permutation data.\n",
618616
"\n",
619-
"You can call each of the above attributes on their own:"
617+
"You can call each of the above attributes individually:"
620618
]
621619
},
622620
{
@@ -645,7 +643,7 @@
645643
"id": "5eafcc8e",
646644
"metadata": {},
647645
"source": [
648-
"Attributes of the weighted delta can also be written to a `dict` by using the ``.to_dict()`` function. Below, we do this and subsequently convert the dict into a dataframe for better readability:\n"
646+
"Attributes of the weighted delta can also be recorded in a `dict` using the ``to_dict()`` function. Here, we demonstrate this process and then convert the generated dictionary into a dataframe for enhanced readability:\n"
649647
]
650648
},
651649
{
@@ -833,15 +831,15 @@
833831
"id": "7797244d",
834832
"metadata": {},
835833
"source": [
836-
"## Producing estimation plots - unpaired data"
834+
"## Generating estimation plots - unpaired data"
837835
]
838836
},
839837
{
840838
"cell_type": "markdown",
841839
"id": "d51a505d",
842840
"metadata": {},
843841
"source": [
844-
"Simply passing the ``.plot()`` method will produce a **Cumming estimation plot** showing the data for each experimental replicate as well as the calculated weighted delta.\n"
842+
"Calling the ``plot()`` method produces a **Cumming estimation plot** showing the data for each experimental replicate as well as the calculated weighted delta.\n"
845843
]
846844
},
847845
{
@@ -929,8 +927,7 @@
929927
"id": "9103409b",
930928
"metadata": {},
931929
"source": [
932-
"The tutorial up to this point has dealt with unpaired data. If your data is paired data, the process for loading, plotting and accessing the data is the same as for unpaired data, except the argument ``paired = \"sequential\" or \"baseline\"`` and an appropriate ``id_col`` are passed during the ``dabest.load()`` step, as follows:\n",
933-
" "
930+
"The tutorial up to this point has focused on unpaired data. If your data is paired, the process for loading, plotting, and accessing the data is similar to that for unpaired data, with the exception that the argument ``paired=\"sequential\"`` or ``paired=\"baseline\"`` and an appropriate ``id_col`` are passed during the ``dabest.load()`` step, as shown below:"
934931
]
935932
},
936933
{
Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"source": [
88
"# Delta - Delta\n",
99
"\n",
10-
"> Explanation of how to calculate delta-delta using dabest.\n",
10+
"> Explanation of how to calculate delta-delta using DABEST.\n",
1111
"\n",
1212
"- order: 5"
1313
]
@@ -17,13 +17,13 @@
1717
"id": "cfdb7e31",
1818
"metadata": {},
1919
"source": [
20-
"Since version 2023.02.14, DABEST also supports the calculation of delta-delta, an experimental function that allows the comparison between two bootstrapped effect sizes computed from two independent categorical variables. \n",
20+
"Since version 2023.02.14, DABEST also supports the calculation of delta-delta, an experimental function that enables the comparison between two bootstrapped effect sizes computed from two independent categorical variables. \n",
2121
"\n",
22-
"Many experimental designs investigate the effects of two interacting independent variables on a dependent variable. The delta-delta effect size lets us distill the net effect of the two variables. To illustrate this, let's delve into the following problem. \n",
22+
"Many experimental designs investigate the effects of two interacting independent variables on a dependent variable. The delta-delta effect size lets us distill the net effect of the two variables. To illustrate this, let's explore the following problem. \n",
2323
"\n",
2424
"Consider an experiment where we test the efficacy of a drug named ``Drug`` on a disease-causing mutation ``M`` based on disease metric ``Y``. The greater value ``Y`` has the more severe the disease phenotype is. Phenotype ``Y`` has been shown to be caused by a gain of function mutation ``M``, so we expect a difference between wild type (``W``) subjects and mutant subjects (``M``). Now, we want to know whether this effect is ameliorated by the administration of ``Drug`` treatment. We also administer a placebo as a control. In theory, we only expect ``Drug`` to have an effect on the ``M`` group, although in practice many drugs have non-specific effects on healthy populations too.\n",
2525
"\n",
26-
"Effectively, we have 4 groups of subjects for comparison. \n"
26+
"Effectively, we have four groups of subjects for comparison."
2727
]
2828
},
2929
{
@@ -42,15 +42,15 @@
4242
"id": "be4d9084",
4343
"metadata": {},
4444
"source": [
45-
"There are 2 ``Treatment`` conditions, ``Placebo`` (control group) and ``Drug`` (test group). There are 2 ``Genotype``\\s: ``W`` (wild type population) and ``M`` (mutant population). In addition, each experiment was done twice (``Rep1`` and ``Rep2``). We shall do a few analyses to visualise these differences in a simulated dataset. \n"
45+
"There are two ``Treatment`` conditions, ``Placebo`` (control group) and ``Drug`` (test group). There are two ``Genotype``\\s: ``W`` (wild type population) and ``M`` (mutant population). Additionally, each experiment was conducted twice (``Rep1`` and ``Rep2``). We will perform several analyses to visualise these differences in a simulated dataset. \n"
4646
]
4747
},
4848
{
4949
"cell_type": "markdown",
5050
"id": "9ec30d58",
5151
"metadata": {},
5252
"source": [
53-
"## Load Libraries"
53+
"## Load libraries"
5454
]
5555
},
5656
{
@@ -235,7 +235,7 @@
235235
"id": "50d94de3",
236236
"metadata": {},
237237
"source": [
238-
"## Unpaired Data"
238+
"## Unpaired data"
239239
]
240240
},
241241
{
@@ -410,7 +410,7 @@
410410
"id": "054d04d2",
411411
"metadata": {},
412412
"source": [
413-
"## Specifying Grouping for Comparisons"
413+
"## Specifying grouping for comparisons"
414414
]
415415
},
416416
{
@@ -453,7 +453,7 @@
453453
"id": "d513187c",
454454
"metadata": {},
455455
"source": [
456-
"## Paired Data"
456+
"## Paired data"
457457
]
458458
},
459459
{
@@ -522,7 +522,7 @@
522522
"id": "ea1da476",
523523
"metadata": {},
524524
"source": [
525-
"## Standardising Delta-delta Effect Sizes with Deltas' g"
525+
"## Standardising delta-delta effect sizes with Deltas' g"
526526
]
527527
},
528528
{
@@ -637,7 +637,7 @@
637637
"id": "044a5fab",
638638
"metadata": {},
639639
"source": [
640-
"## Omitting Delta-delta Plot"
640+
"## Omitting delta-delta plot"
641641
]
642642
},
643643
{
@@ -674,7 +674,7 @@
674674
"id": "0b3a3da4",
675675
"metadata": {},
676676
"source": [
677-
"## Other Effect Sizes"
677+
"## Other effect sizes"
678678
]
679679
},
680680
{
@@ -730,7 +730,7 @@
730730
"id": "c1a0cada",
731731
"metadata": {},
732732
"source": [
733-
"### Delta-delta Statistics"
733+
"### Delta-delta statistics"
734734
]
735735
},
736736
{
@@ -788,7 +788,7 @@
788788
"id": "75dde9a4",
789789
"metadata": {},
790790
"source": [
791-
"### Standardised Delta-delta Statistics "
791+
"### Standardised delta-delta statistics "
792792
]
793793
},
794794
{
@@ -823,14 +823,6 @@
823823
"source": [
824824
"unpaired_delta2.delta_g.delta_delta"
825825
]
826-
},
827-
{
828-
"cell_type": "code",
829-
"execution_count": null,
830-
"id": "bed677a7",
831-
"metadata": {},
832-
"outputs": [],
833-
"source": []
834826
}
835827
],
836828
"metadata": {
Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,6 @@
1010
"- order: 5"
1111
]
1212
},
13-
{
14-
"cell_type": "markdown",
15-
"id": "7879a287",
16-
"metadata": {},
17-
"source": [
18-
"Changing the y-axes labels."
19-
]
20-
},
2113
{
2214
"cell_type": "code",
2315
"execution_count": null,

0 commit comments

Comments
 (0)