Skip to content

Commit f5c8f18

Browse files
committedFeb 19, 2025·
update vignettes
1 parent 639d4b0 commit f5c8f18

12 files changed

+277
-178
lines changed
 

‎README.md

+209-170
Large diffs are not rendered by default.

‎inst/figures/unnamed-chunk-11-1.png

-1.32 KB
Loading

‎inst/figures/unnamed-chunk-12-1.png

58.7 KB
Loading

‎inst/figures/unnamed-chunk-13-1.png

15.6 KB
Loading

‎inst/figures/unnamed-chunk-14-1.png

-15.6 KB
Loading

‎inst/figures/unnamed-chunk-24-1.png

-186 Bytes
Loading

‎inst/figures/unnamed-chunk-25-1.png

30.8 KB
Loading

‎inst/figures/unnamed-chunk-26-1.png

-5.68 KB
Loading

‎inst/figures/unnamed-chunk-27-1.png

41 KB
Loading

‎inst/figures/unnamed-chunk-28-1.png

79.1 KB
Loading

‎man/fragments/intro.Rmd

+34-4
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ sccomp_result =
9898
.cell_group = cell_group,
9999
cores = 1
100100
) |>
101-
sccomp_remove_outliers(cores = 1) |> # Optional
102101
sccomp_test()
103102
104103
```
@@ -116,7 +115,6 @@ sccomp_result =
116115
.count = count,
117116
cores = 1, verbose = FALSE
118117
) |>
119-
sccomp_remove_outliers(cores = 1, verbose = FALSE) |> # Optional
120118
sccomp_test()
121119
```
122120

@@ -144,6 +142,24 @@ The output is a tibble containing the **Following columns**
144142
sccomp_result
145143
```
146144

145+
## Outlier identification
146+
147+
`sccomp` can identify outliers probabilistically and exclude them from the estimation.
148+
149+
```{r, message=FALSE, warning=FALSE, eval = instantiate::stan_cmdstan_exists()}
150+
151+
sccomp_result =
152+
counts_obj |>
153+
sccomp_estimate(
154+
formula_composition = ~ type,
155+
.sample = sample,
156+
.cell_group = cell_group,
157+
.count = count,
158+
cores = 1, verbose = FALSE
159+
) |>
160+
sccomp_remove_outliers(cores = 1, verbose = FALSE) |> # Optional
161+
sccomp_test()
162+
```
147163

148164
## Summary plots
149165

@@ -185,6 +201,20 @@ The use of proportions is better suited for modelling deconvolution results (e.g
185201

186202
Proportions should be greater than 0. Assuming that zeros derive from a precision threshold (e.g., deconvolution), zeros are converted to the smallest non-zero value.
187203

204+
```{r, message=FALSE, warning=FALSE, eval = instantiate::stan_cmdstan_exists()}
205+
206+
sccomp_result =
207+
counts_obj |>
208+
sccomp_estimate(
209+
formula_composition = ~ type,
210+
.sample = sample,
211+
.cell_group = cell_group,
212+
.count = proportion,
213+
cores = 1, verbose = FALSE
214+
) |>
215+
sccomp_remove_outliers(cores = 1, verbose = FALSE) |> # Optional
216+
sccomp_test()
217+
```
188218

189219
## Continuous factor
190220

@@ -281,7 +311,7 @@ In the case of a categorical variable, the starting and ending points are catego
281311
sccomp_result |>
282312
sccomp_proportional_fold_change(
283313
formula_composition = ~ type,
284-
from = "healthy",
314+
from = "benign",
285315
to = "cancer"
286316
) |>
287317
select(cell_group, statement)
@@ -307,7 +337,7 @@ seurat_obj |>
307337

308338
## Categorical factor (e.g. Bayesian ANOVA)
309339

310-
This is achieved through model comparison with `loo`. In the following example, the model with association with factors better fits the data compared to the baseline model with no factor association. For comparisons `check_outliers` must be set to FALSE as the leave-one-out must work with the same amount of data, while outlier elimination does not guarantee it.
340+
This is achieved through model comparison with `loo`. In the following example, the model with association with factors better fits the data compared to the baseline model with no factor association. For model comparisons `sccomp_remove_outliers()` must not be executed as the leave-one-out must work with the same amount of data, while outlier elimination does not guarantee it.
311341

312342
If `elpd_diff` is away from zero of \> 5 `se_diff` difference of 5, we are confident that a model is better than the other [reference](https://discourse.mc-stan.org/t/interpreting-elpd-diff-loo-package/1628/2?u=stemangiola).
313343
In this case, -79.9 / 11.5 = -6.9, therefore we can conclude that model one, the one with factor association, is better than model two.

‎vignettes/introduction.Rmd

+34-4
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ sccomp_result =
147147
.cell_group = cell_group,
148148
cores = 1
149149
) |>
150-
sccomp_remove_outliers(cores = 1) |> # Optional
151150
sccomp_test()
152151
153152
```
@@ -165,7 +164,6 @@ sccomp_result =
165164
.count = count,
166165
cores = 1, verbose = FALSE
167166
) |>
168-
sccomp_remove_outliers(cores = 1, verbose = FALSE) |> # Optional
169167
sccomp_test()
170168
```
171169

@@ -193,6 +191,24 @@ The output is a tibble containing the **Following columns**
193191
sccomp_result
194192
```
195193

194+
## Outlier identification
195+
196+
`sccomp` can identify outliers probabilistically and exclude them from the estimation.
197+
198+
```{r, message=FALSE, warning=FALSE, eval = instantiate::stan_cmdstan_exists()}
199+
200+
sccomp_result =
201+
counts_obj |>
202+
sccomp_estimate(
203+
formula_composition = ~ type,
204+
.sample = sample,
205+
.cell_group = cell_group,
206+
.count = count,
207+
cores = 1, verbose = FALSE
208+
) |>
209+
sccomp_remove_outliers(cores = 1, verbose = FALSE) |> # Optional
210+
sccomp_test()
211+
```
196212

197213
## Summary plots
198214

@@ -234,6 +250,20 @@ The use of proportions is better suited for modelling deconvolution results (e.g
234250

235251
Proportions should be greater than 0. Assuming that zeros derive from a precision threshold (e.g., deconvolution), zeros are converted to the smallest non-zero value.
236252

253+
```{r, message=FALSE, warning=FALSE, eval = instantiate::stan_cmdstan_exists()}
254+
255+
sccomp_result =
256+
counts_obj |>
257+
sccomp_estimate(
258+
formula_composition = ~ type,
259+
.sample = sample,
260+
.cell_group = cell_group,
261+
.count = proportion,
262+
cores = 1, verbose = FALSE
263+
) |>
264+
sccomp_remove_outliers(cores = 1, verbose = FALSE) |> # Optional
265+
sccomp_test()
266+
```
237267

238268
## Continuous factor
239269

@@ -330,7 +360,7 @@ In the case of a categorical variable, the starting and ending points are catego
330360
res |>
331361
sccomp_proportional_fold_change(
332362
formula_composition = ~ type,
333-
from = "healthy",
363+
from = "benign",
334364
to = "cancer"
335365
) |>
336366
select(cell_group, statement)
@@ -356,7 +386,7 @@ seurat_obj |>
356386

357387
## Categorical factor (e.g. Bayesian ANOVA)
358388

359-
This is achieved through model comparison with `loo`. In the following example, the model with association with factors better fits the data compared to the baseline model with no factor association. For comparisons `check_outliers` must be set to FALSE as the leave-one-out must work with the same amount of data, while outlier elimination does not guarantee it.
389+
This is achieved through model comparison with `loo`. In the following example, the model with association with factors better fits the data compared to the baseline model with no factor association. For model comparisons `sccomp_remove_outliers()` must not be executed as the leave-one-out must work with the same amount of data, while outlier elimination does not guarantee it.
360390

361391
If `elpd_diff` is away from zero of \> 5 `se_diff` difference of 5, we are confident that a model is better than the other [reference](https://discourse.mc-stan.org/t/interpreting-elpd-diff-loo-package/1628/2?u=stemangiola).
362392
In this case, -79.9 / 11.5 = -6.9, therefore we can conclude that model one, the one with factor association, is better than model two.

0 commit comments

Comments
 (0)
Please sign in to comment.