diff --git a/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example.Rmd b/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example.Rmd index cc2cb6a..bc2a3f8 100644 --- a/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example.Rmd +++ b/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example.Rmd @@ -46,7 +46,7 @@ set.seed(42) n_species <- 10 n_samples <- 50 -species <- str_c("Species ", seq(n_species)) +species <- str_c("Sp. ", seq(n_species)) ``` ## Actual abundances @@ -167,7 +167,6 @@ species_params %>% Question: Is it true that the first species is driving the association? - The measured (i.e. estimated) proportions and abundances are given by perturbing the actual abundances by the efficiencies, and normalizing to proportions or to the original (correct) total. ```{r} @@ -216,12 +215,12 @@ abun <- bind_rows( ```{r} p_species_all <- abun %>% ggplot(aes(x, log2_abundance, color = type)) + - labs(y = "Log abundance ") + + labs(y = "Log efficiency", x = "Condition (x)") + facet_grid(.otu~type, scales = "fixed") + geom_quasirandom(alpha = 0.3, groupOnX = TRUE) + # stat_summary(fun.data = "mean_cl_boot", geom = "pointrange") + - stat_summary(geom = "point") + - stat_smooth(aes(x = as.integer(x)), + stat_summary(geom = "point", fun.data = mean_se) + + stat_smooth(aes(x = as.integer(x)), formula = y~x, method = "lm", size = 0.9, fill = 'grey', se = FALSE ) + theme(legend.position = "none") @@ -231,11 +230,11 @@ p_species_all ```{r} p_mean_eff <- mean_eff %>% ggplot(aes(x, log2(mean_efficiency))) + - labs(y = "Log efficiency ") + + labs(y = "Log efficiency", x = "Condition (x)") + geom_quasirandom(alpha = 0.3, groupOnX = TRUE) + # stat_summary(fun.data = "mean_cl_boot", geom = "pointrange") + - stat_summary(geom = "point") + - stat_smooth(aes(x = as.integer(x)), + stat_summary(geom = "point", fun.data = mean_se) + + stat_smooth(aes(x = as.integer(x)), formula = y~x, method = "lm", size = 0.9, color = 'black', fill = 'grey', se = FALSE ) p_mean_eff @@ -284,21 +283,28 @@ lm_results_slope <- lm_results %>% ```{r, fig.dim = c(5.5, 7)} # params for arrows showing error delta <- lm_results_mean_eff %>% filter(term == "x1") %>% pull(estimate) -start <- lm_results_slope %>% filter(type == 'Actual', .otu == 'Species 9') %>% +start <- lm_results_slope %>% filter(type == 'Actual', .otu == 'Sp. 9') %>% pull(estimate) p_coef_ci <- lm_results_slope %>% ggplot(aes(y = .otu, x = estimate, color = type)) + - labs(x = "Log fold difference", y = NULL) + + labs(x = "Mean LFD", y = NULL, color = "Type") + geom_vline(xintercept = 0, color = "grey") + geom_pointinterval(aes(xmin = conf.low, xmax = conf.high)) + theme(legend.position = 'top') + guides(color = guide_legend(reverse = TRUE)) + annotate( - geom = 'segment', color = "darkgrey", + geom = 'segment', color = "darkred", arrow = grid::arrow(length = unit(0.1, "inches")), x = start, xend = start - delta, - y = 10.5, yend = 10.5 + y = 10.5, yend = 10.5, + size = .7 + ) + + annotate( + geom = 'text', color = "darkred", + label = 'Effect of bias', + x = start - delta/2, + y = 10.8, ) + coord_cartesian(clip = 'off') @@ -315,19 +321,20 @@ p_coef_ci_mean_eff <- lm_results_mean_eff %>% min(lm_results_slope$conf.low), max(lm_results_slope$conf.high) )) + - labs(x = "Log fold difference", y = NULL) + + labs(x = "Mean LFD", y = NULL) + geom_vline(xintercept = 0, color = "grey") + geom_point() + annotate( - geom = 'segment', color = "darkgrey", + geom = 'segment', color = "darkred", arrow = grid::arrow(length = unit(0.1, "inches")), x = 0, xend = delta, - y = 1.0, yend = 1.0 + y = 1.0, yend = 1.0, + size = .7 ) p_coef_dot <- lm_results_slope %>% ggplot(aes(y = type, x = estimate, fill = type)) + - labs(x = "Log fold difference", y = "Type") + + labs(x = "Mean LFD", y = "Type") + geom_vline(xintercept = 0, color = "grey") + stat_dots() @@ -353,7 +360,7 @@ Chose species that show the full range of qualitative behaviors in terms of the ```{r} -species_to_plot <- str_c("Species ", c('9', '10', '5', '7', '2')) +species_to_plot <- str_c("Sp. ", c('9', '10', '5', '7', '2')) p_species_focal <- p_species_all p_species_focal$data <- p_species_focal$data %>% filter(.otu %in% species_to_plot) @@ -380,7 +387,7 @@ p_mean_eff1 <- p_mean_eff + (p_mean_eff1 + ggtitle("Mean efficiency")) + (p_coef_ci_mean_eff + ggtitle("LFD in mean efficiency")) + (p_species_focal + ggtitle("Actual and measured\nabundances of select species")) + - (p_coef_ci1 + ggtitle("Estimated LFDs of all species") + + (p_coef_ci1 + ggtitle("Mean LFD estimated from\nactual or measured abundances") + theme(legend.box.margin = margin(b = -15)) ) + plot_layout(ncol = 2, heights = c(0.2, 1)) + @@ -465,3 +472,66 @@ The prediction for the squared standard error from the theoretical calculation a TODO: Sort out why it is this version, and not the other, that gives agreement. Perhaps the standard errors being returned by R are using the MLE estimate of sigma instead of the OLS estimate? + +## 2022-10-08 Modified main figure + +New panel showing simulated efficiencies and mean LFDs, to replace the panel showing the change in mean efficiency (former panel B). + +```{r} +p_params <- species_params %>% + ggplot(aes(x1, log2_efficiency)) + + theme(axis.line = element_blank()) + + # panel_border(remove = TRUE) + + # theme_minimal_grid() + + coord_cartesian(clip = 'off') + + geom_vline(xintercept = 0, color = 'grey') + + geom_hline(yintercept = 0, color = 'grey') + + geom_text( + aes(label = str_c('Sp. ', str_extract(.otu, '[0-9]+'))), + size = 4) + + labs( + x = 'Expected LFD', + y = 'Log efficiency' + ) +p_params +``` + +Annotate mean efficiency plot, + +```{r} +# params for arrow showing change +arrow_params <- mean_eff %>% + with_groups(x, summarize, across(log2_mean_efficiency, mean)) %>% + pull(log2_mean_efficiency) + +p_mean_eff2 <- p_mean_eff + + annotate( + geom = 'segment', color = "darkred", + arrow = grid::arrow(length = unit(0.1, "inches")), + x = 2.5, xend = 2.5, + y = arrow_params[1], + yend = arrow_params[2], + size = .7 + ) +p_mean_eff2 +``` + +Assemble with improved titles, + +```{r main-figure-2, fig.dim = c(8, 9)} + +(p_params + ggtitle("Simulated log efficiencies\nand expected LFDs")) + + (p_mean_eff2 + ggtitle("Mean efficiency across\nsamples in each condition")) + + # (p_coef_ci_mean_eff + ggtitle("LFD in mean efficiency")) + + (p_species_focal + ggtitle("Actual and measured\nabundances of select species")) + + (p_coef_ci1 + ggtitle("Mean LFD estimated from\nactual or measured abundances") + + theme(legend.box.margin = margin(b = -15)) + ) + + plot_layout(ncol = 2, heights = c(0.4, 1)) + + plot_annotation(tag_levels = 'A') & + colorblindr::scale_color_OkabeIto() & + colorblindr::scale_fill_OkabeIto() & + theme( + plot.title = element_text(face = "plain") + ) +``` diff --git a/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example.html b/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example.html index c6ae5d9..3999bda 100644 --- a/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example.html +++ b/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example.html @@ -118,7 +118,7 @@ @@ -1517,21 +1517,29 @@

Simulate regression example

@@ -1561,7 +1569,7 @@

Simulate data

n_species <- 10
 n_samples <- 50
 
-species <- str_c("Species ", seq(n_species))
+species <- str_c("Sp. ", seq(n_species))
 
@@ -1613,28 +1621,28 @@

Actual abundances

#> # A tibble: 20 × 3
-#>    term        .otu         truth
-#>    <chr>       <chr>        <dbl>
-#>  1 (Intercept) Species 1  -0.0905
-#>  2 (Intercept) Species 2   2.91  
-#>  3 (Intercept) Species 3  -0.137 
-#>  4 (Intercept) Species 4   2.18  
-#>  5 (Intercept) Species 5  -0.153 
-#>  6 (Intercept) Species 6   0.583 
-#>  7 (Intercept) Species 7   0.913 
-#>  8 (Intercept) Species 8   0.524 
-#>  9 (Intercept) Species 9  -0.815 
-#> 10 (Intercept) Species 10  1.98  
-#> 11 x1          Species 1   1.90  
-#> 12 x1          Species 2  -3.52  
-#> 13 x1          Species 3  -3.83  
-#> 14 x1          Species 4  -0.410 
-#> 15 x1          Species 5   0.917 
-#> 16 x1          Species 6  -0.192 
-#> 17 x1          Species 7  -0.402 
-#> 18 x1          Species 8  -2.00  
-#> 19 x1          Species 9   3.30  
-#> 20 x1          Species 10  1.88
+#> term .otu truth +#> <chr> <chr> <dbl> +#> 1 (Intercept) Sp. 1 -0.0905 +#> 2 (Intercept) Sp. 2 2.91 +#> 3 (Intercept) Sp. 3 -0.137 +#> 4 (Intercept) Sp. 4 2.18 +#> 5 (Intercept) Sp. 5 -0.153 +#> 6 (Intercept) Sp. 6 0.583 +#> 7 (Intercept) Sp. 7 0.913 +#> 8 (Intercept) Sp. 8 0.524 +#> 9 (Intercept) Sp. 9 -0.815 +#> 10 (Intercept) Sp. 10 1.98 +#> 11 x1 Sp. 1 1.90 +#> 12 x1 Sp. 2 -3.52 +#> 13 x1 Sp. 3 -3.83 +#> 14 x1 Sp. 4 -0.410 +#> 15 x1 Sp. 5 0.917 +#> 16 x1 Sp. 6 -0.192 +#> 17 x1 Sp. 7 -0.402 +#> 18 x1 Sp. 8 -2.00 +#> 19 x1 Sp. 9 3.30 +#> 20 x1 Sp. 10 1.88
@@ -1719,18 +1727,18 @@

Taxonomic bias and

#> # A tibble: 10 × 5
-#>    .otu       intercept     x1 efficiency log2_efficiency
-#>    <chr>          <dbl>  <dbl>      <dbl>           <dbl>
-#>  1 Species 1    -0.0905  1.90      0.0225          -5.48 
-#>  2 Species 2     2.91   -3.52      1.15             0.200
-#>  3 Species 3    -0.137  -3.83      0.213           -2.23 
-#>  4 Species 4     2.18   -0.410     0.0748          -3.74 
-#>  5 Species 5    -0.153   0.917     2.98             1.58 
-#>  6 Species 6     0.583  -0.192     0.339           -1.56 
-#>  7 Species 7     0.913  -0.402     0.892           -0.165
-#>  8 Species 8     0.524  -2.00      1.73             0.787
-#>  9 Species 9    -0.815   3.30    162.               7.34 
-#> 10 Species 10    1.98    1.88      9.62             3.27
+#> .otu intercept x1 efficiency log2_efficiency +#> <chr> <dbl> <dbl> <dbl> <dbl> +#> 1 Sp. 1 -0.0905 1.90 0.0225 -5.48 +#> 2 Sp. 2 2.91 -3.52 1.15 0.200 +#> 3 Sp. 3 -0.137 -3.83 0.213 -2.23 +#> 4 Sp. 4 2.18 -0.410 0.0748 -3.74 +#> 5 Sp. 5 -0.153 0.917 2.98 1.58 +#> 6 Sp. 6 0.583 -0.192 0.339 -1.56 +#> 7 Sp. 7 0.913 -0.402 0.892 -0.165 +#> 8 Sp. 8 0.524 -2.00 1.73 0.787 +#> 9 Sp. 9 -0.815 3.30 162. 7.34 +#> 10 Sp. 10 1.98 1.88 9.62 3.27
@@ -1800,12 +1808,12 @@

Estimated and actual
p_species_all <- abun %>%
   ggplot(aes(x, log2_abundance, color = type)) +
-  labs(y = "Log abundance ") +
+  labs(y = "Log efficiency", x = "Condition (x)") +
   facet_grid(.otu~type, scales = "fixed") +
   geom_quasirandom(alpha = 0.3, groupOnX = TRUE) +
   # stat_summary(fun.data = "mean_cl_boot", geom = "pointrange") +
-  stat_summary(geom = "point") +
-  stat_smooth(aes(x = as.integer(x)),
+  stat_summary(geom = "point", fun.data = mean_se) +
+  stat_smooth(aes(x = as.integer(x)), formula = y~x,
     method = "lm", size = 0.9, fill = 'grey', se = FALSE
   ) +
   theme(legend.position = "none")
@@ -1818,11 +1826,11 @@ 

Estimated and actual
p_mean_eff <- mean_eff %>%
   ggplot(aes(x, log2(mean_efficiency))) +
-  labs(y = "Log efficiency ") +
+  labs(y = "Log efficiency", x = "Condition (x)") +
   geom_quasirandom(alpha = 0.3, groupOnX = TRUE) +
   # stat_summary(fun.data = "mean_cl_boot", geom = "pointrange") +
-  stat_summary(geom = "point") +
-  stat_smooth(aes(x = as.integer(x)),
+  stat_summary(geom = "point", fun.data = mean_se) +
+  stat_smooth(aes(x = as.integer(x)), formula = y~x,
     method = "lm", size = 0.9, color = 'black', fill = 'grey', se = FALSE
   )
 p_mean_eff 
@@ -1880,21 +1888,28 @@ 

Regression coefficients

# params for arrows showing error
 delta <- lm_results_mean_eff %>% filter(term == "x1") %>% pull(estimate)
-start <- lm_results_slope %>% filter(type == 'Actual', .otu == 'Species 9') %>%
+start <- lm_results_slope %>% filter(type == 'Actual', .otu == 'Sp. 9') %>%
   pull(estimate)
 
 p_coef_ci <- lm_results_slope %>% 
   ggplot(aes(y = .otu, x = estimate, color = type)) +
-  labs(x = "Log fold difference", y = NULL) +
+  labs(x = "Mean LFD", y = NULL, color = "Type") +
   geom_vline(xintercept = 0, color = "grey") +
   geom_pointinterval(aes(xmin = conf.low, xmax = conf.high)) +
   theme(legend.position = 'top') +
   guides(color = guide_legend(reverse = TRUE)) +
   annotate(
-    geom = 'segment', color = "darkgrey",
+    geom = 'segment', color = "darkred",
     arrow = grid::arrow(length = unit(0.1, "inches")), 
     x = start, xend = start - delta, 
-    y = 10.5, yend = 10.5
+    y = 10.5, yend = 10.5,
+    size = .7
+  ) +
+  annotate(
+    geom = 'text', color = "darkred",
+    label = 'Effect of bias',
+    x = start - delta/2,
+    y = 10.8,
   ) +
   coord_cartesian(clip = 'off')
 
@@ -1911,19 +1926,20 @@ 

Regression coefficients

min(lm_results_slope$conf.low), max(lm_results_slope$conf.high) )) + - labs(x = "Log fold difference", y = NULL) + + labs(x = "Mean LFD", y = NULL) + geom_vline(xintercept = 0, color = "grey") + geom_point() + annotate( - geom = 'segment', color = "darkgrey", + geom = 'segment', color = "darkred", arrow = grid::arrow(length = unit(0.1, "inches")), x = 0, xend = delta, - y = 1.0, yend = 1.0 + y = 1.0, yend = 1.0, + size = .7 ) p_coef_dot <- lm_results_slope %>% ggplot(aes(y = type, x = estimate, fill = type)) + - labs(x = "Log fold difference", y = "Type") + + labs(x = "Mean LFD", y = "Type") + geom_vline(xintercept = 0, color = "grey") + stat_dots() @@ -1960,7 +1976,7 @@

Manuscript figure

-
species_to_plot <- str_c("Species ", c('9', '10', '5', '7', '2'))
+
species_to_plot <- str_c("Sp. ", c('9', '10', '5', '7', '2'))
 p_species_focal <- p_species_all
 p_species_focal$data <- p_species_focal$data %>% 
   filter(.otu %in% species_to_plot)
@@ -1989,7 +2005,7 @@ 

Manuscript figure

(p_mean_eff1 + ggtitle("Mean efficiency")) +
   (p_coef_ci_mean_eff + ggtitle("LFD in mean efficiency")) + 
   (p_species_focal + ggtitle("Actual and measured\nabundances of select species")) + 
-  (p_coef_ci1 + ggtitle("Estimated LFDs of all species") +
+  (p_coef_ci1 + ggtitle("Mean LFD estimated from\nactual or measured abundances") +
     theme(legend.box.margin = margin(b = -15))
   ) + 
   plot_layout(ncol = 2, heights = c(0.2, 1)) +
@@ -2053,18 +2069,18 @@ 

Standard errors

#> # A tibble: 10 × 2
-#>    .otu           cov
-#>    <fct>        <dbl>
-#>  1 Species 9   0.565 
-#>  2 Species 1  -0.111 
-#>  3 Species 10 -0.163 
-#>  4 Species 5  -0.0326
-#>  5 Species 6  -0.0115
-#>  6 Species 7  -0.0672
-#>  7 Species 4  -0.172 
-#>  8 Species 8  -0.105 
-#>  9 Species 2   0.0449
-#> 10 Species 3   0.0338
+#> .otu cov +#> <fct> <dbl> +#> 1 Sp. 9 0.565 +#> 2 Sp. 1 -0.111 +#> 3 Sp. 10 -0.163 +#> 4 Sp. 5 -0.0326 +#> 5 Sp. 6 -0.0115 +#> 6 Sp. 7 -0.0672 +#> 7 Sp. 4 -0.172 +#> 8 Sp. 8 -0.105 +#> 9 Sp. 2 0.0449 +#> 10 Sp. 3 0.0338
@@ -2079,18 +2095,18 @@

Standard errors

#> # A tibble: 10 × 4
-#>    .otu       se_Actual se_Measured     cov
-#>    <fct>          <dbl>       <dbl>   <dbl>
-#>  1 Species 3      0.292       0.341  0.0338
-#>  2 Species 2      0.311       0.354  0.0449
-#>  3 Species 8      0.244       0.336 -0.105 
-#>  4 Species 4      0.252       0.357 -0.172 
-#>  5 Species 6      0.278       0.340 -0.0115
-#>  6 Species 7      0.290       0.363 -0.0672
-#>  7 Species 5      0.269       0.337 -0.0326
-#>  8 Species 1      0.283       0.367 -0.111 
-#>  9 Species 10     0.289       0.383 -0.163 
-#> 10 Species 9      0.270       0.130  0.565
+#> .otu se_Actual se_Measured cov +#> <fct> <dbl> <dbl> <dbl> +#> 1 Sp. 3 0.292 0.341 0.0338 +#> 2 Sp. 2 0.311 0.354 0.0449 +#> 3 Sp. 8 0.244 0.336 -0.105 +#> 4 Sp. 4 0.252 0.357 -0.172 +#> 5 Sp. 6 0.278 0.340 -0.0115 +#> 6 Sp. 7 0.290 0.363 -0.0672 +#> 7 Sp. 5 0.269 0.337 -0.0326 +#> 8 Sp. 1 0.283 0.367 -0.111 +#> 9 Sp. 10 0.289 0.383 -0.163 +#> 10 Sp. 9 0.270 0.130 0.565

@@ -2104,24 +2120,93 @@

Standard errors

#> # A tibble: 10 × 6
-#>    .otu       se_Actual se_Measured     cov se2_Measured   pred
-#>    <fct>          <dbl>       <dbl>   <dbl>        <dbl>  <dbl>
-#>  1 Species 3      0.292       0.341  0.0338       0.116  0.116 
-#>  2 Species 2      0.311       0.354  0.0449       0.125  0.125 
-#>  3 Species 8      0.244       0.336 -0.105        0.113  0.113 
-#>  4 Species 4      0.252       0.357 -0.172        0.128  0.128 
-#>  5 Species 6      0.278       0.340 -0.0115       0.115  0.115 
-#>  6 Species 7      0.290       0.363 -0.0672       0.132  0.132 
-#>  7 Species 5      0.269       0.337 -0.0326       0.114  0.114 
-#>  8 Species 1      0.283       0.367 -0.111        0.135  0.135 
-#>  9 Species 10     0.289       0.383 -0.163        0.147  0.147 
-#> 10 Species 9      0.270       0.130  0.565        0.0170 0.0170
+#> .otu se_Actual se_Measured cov se2_Measured pred +#> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> +#> 1 Sp. 3 0.292 0.341 0.0338 0.116 0.116 +#> 2 Sp. 2 0.311 0.354 0.0449 0.125 0.125 +#> 3 Sp. 8 0.244 0.336 -0.105 0.113 0.113 +#> 4 Sp. 4 0.252 0.357 -0.172 0.128 0.128 +#> 5 Sp. 6 0.278 0.340 -0.0115 0.115 0.115 +#> 6 Sp. 7 0.290 0.363 -0.0672 0.132 0.132 +#> 7 Sp. 5 0.269 0.337 -0.0326 0.114 0.114 +#> 8 Sp. 1 0.283 0.367 -0.111 0.135 0.135 +#> 9 Sp. 10 0.289 0.383 -0.163 0.147 0.147 +#> 10 Sp. 9 0.270 0.130 0.565 0.0170 0.0170

The prediction for the squared standard error from the theoretical calculation agrees with what we observe.

TODO: Sort out why it is this version, and not the other, that gives agreement. Perhaps the standard errors being returned by R are using the MLE estimate of sigma instead of the OLS estimate?

+

2022-10-08 Modified main figure

+

New panel showing simulated efficiencies and mean LFDs, to replace +the panel showing the change in mean efficiency (former panel B).

+
+
+
p_params <- species_params %>%
+  ggplot(aes(x1, log2_efficiency)) +
+  theme(axis.line = element_blank()) +
+  # panel_border(remove = TRUE) +
+  # theme_minimal_grid() +
+  coord_cartesian(clip = 'off') +
+  geom_vline(xintercept = 0, color = 'grey') +
+  geom_hline(yintercept = 0, color = 'grey') +
+  geom_text(
+    aes(label = str_c('Sp. ', str_extract(.otu, '[0-9]+'))), 
+    size = 4) +
+  labs(
+    x = 'Expected LFD',
+    y = 'Log efficiency'
+  )
+p_params 
+
+
+

+
+

Annotate mean efficiency plot,

+
+
+
# params for arrow showing change
+arrow_params <- mean_eff %>%
+  with_groups(x, summarize, across(log2_mean_efficiency, mean)) %>%
+  pull(log2_mean_efficiency)
+
+p_mean_eff2 <- p_mean_eff +
+  annotate(
+    geom = 'segment', color = "darkred",
+    arrow = grid::arrow(length = unit(0.1, "inches")), 
+    x = 2.5, xend = 2.5, 
+    y = arrow_params[1], 
+    yend = arrow_params[2], 
+    size = .7
+  )
+p_mean_eff2 
+
+
+

+
+

Assemble with improved titles,

+
+
+

+(p_params + ggtitle("Simulated log efficiencies\nand expected LFDs")) +
+  (p_mean_eff2 + ggtitle("Mean efficiency across\nsamples in each condition")) +
+  # (p_coef_ci_mean_eff + ggtitle("LFD in mean efficiency")) + 
+  (p_species_focal + ggtitle("Actual and measured\nabundances of select species")) + 
+  (p_coef_ci1 + ggtitle("Mean LFD estimated from\nactual or measured abundances") +
+    theme(legend.box.margin = margin(b = -15))
+  ) + 
+  plot_layout(ncol = 2, heights = c(0.4, 1)) +
+  plot_annotation(tag_levels = 'A') &
+  colorblindr::scale_color_OkabeIto() &
+  colorblindr::scale_fill_OkabeIto() &
+  theme(
+    plot.title = element_text(face = "plain")
+  )
+
+
+

+
diff --git a/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/main-figure-1.svg b/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/main-figure-1.svg index 79da006..e419082 100644 --- a/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/main-figure-1.svg +++ b/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/main-figure-1.svg @@ -93,53 +93,59 @@ - + - + - + - + + - + - - + - + - + - + - + - + - + - + - + + + + + + + @@ -173,18 +179,6 @@ - - - - - - - - - - - - @@ -258,9 +252,6 @@ - - - @@ -284,75 +275,94 @@ - + - - - - - - - - - - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -387,15 +397,12 @@ - - - - + - + @@ -476,22 +483,33 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -515,8 +533,8 @@ - - + + @@ -569,24 +587,14 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + @@ -1184,74 +1192,52 @@ - - - - - - - - - + + + + + - - - - - - - - - - - - + + + + + + - + - - - - - - - - - + + + + + - + - - - - - - - - - + + + + + - + - - - - - - - - - + + + + + @@ -1367,23 +1353,33 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1440,170 +1436,145 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1639,83 +1610,98 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/main-figure-2-1.svg b/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/main-figure-2-1.svg new file mode 100644 index 0000000..961c149 --- /dev/null +++ b/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/main-figure-2-1.svg @@ -0,0 +1,1877 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/unnamed-chunk-15-1.svg b/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/unnamed-chunk-15-1.svg index 89ed4c0..5564c46 100644 --- a/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/unnamed-chunk-15-1.svg +++ b/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/unnamed-chunk-15-1.svg @@ -58,54 +58,71 @@ - + - - - - - - - - - - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -120,25 +137,22 @@ - + - + - + - + - + - - - - + @@ -2024,15 +2038,11 @@ - - - - - - - - - + + + + + @@ -2040,15 +2050,11 @@ - - - - - - - - - + + + + + @@ -2056,16 +2062,12 @@ - - - - - - - - - - + + + + + + @@ -2073,15 +2075,11 @@ - - - - - - - - - + + + + + @@ -2089,15 +2087,11 @@ - - - - - - - - - + + + + + @@ -2105,15 +2099,11 @@ - - - - - - - - - + + + + + @@ -2121,15 +2111,11 @@ - - - - - - - - - + + + + + @@ -2137,15 +2123,11 @@ - - - - - - - - - + + + + + @@ -2153,15 +2135,11 @@ - - - - - - - - - + + + + + @@ -2169,15 +2147,11 @@ - - - - - - - - - + + + + + @@ -2399,22 +2373,32 @@ - + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/unnamed-chunk-16-1.svg b/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/unnamed-chunk-16-1.svg index 361d2bd..8302a11 100644 --- a/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/unnamed-chunk-16-1.svg +++ b/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/unnamed-chunk-16-1.svg @@ -28,8 +28,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -148,21 +174,32 @@ - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/unnamed-chunk-17-1.svg b/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/unnamed-chunk-17-1.svg index fa88f2b..3065043 100644 --- a/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/unnamed-chunk-17-1.svg +++ b/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/unnamed-chunk-17-1.svg @@ -64,8 +64,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -97,18 +123,6 @@ - - - - - - - - - - - - @@ -118,47 +132,38 @@ - + - - - - - - - - - - + - + - + - + - + - + - + - + - + @@ -2225,22 +2230,33 @@ - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + @@ -4924,15 +4940,11 @@ - - - - - - - - - + + + + + @@ -4940,15 +4952,11 @@ - - - - - - - - - + + + + + @@ -4956,16 +4964,12 @@ - - - - - - - - - - + + + + + + @@ -4973,15 +4977,11 @@ - - - - - - - - - + + + + + @@ -4989,15 +4989,11 @@ - - - - - - - - - + + + + + @@ -5005,15 +5001,11 @@ - - - - - - - - - + + + + + @@ -5021,15 +5013,11 @@ - - - - - - - - - + + + + + @@ -5037,15 +5025,11 @@ - - - - - - - - - + + + + + @@ -5053,15 +5037,11 @@ - - - - - - - - - + + + + + @@ -5069,15 +5049,11 @@ - - - - - - - - - + + + + + @@ -5299,22 +5275,32 @@ - + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/unnamed-chunk-20-1.svg b/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/unnamed-chunk-20-1.svg index 1bb3202..d93e3f7 100644 --- a/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/unnamed-chunk-20-1.svg +++ b/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/unnamed-chunk-20-1.svg @@ -55,25 +55,25 @@ - + - + - + - + - + - + - + @@ -96,69 +96,94 @@ - + - + - + + - - + - + - + - + - + - + - + - - + - - + + - - + + - - + + - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + @@ -174,8 +199,8 @@ - - + + @@ -228,220 +253,185 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -477,52 +467,42 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -560,7 +540,7 @@ - + @@ -596,36 +576,26 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + @@ -641,7 +611,7 @@ - + diff --git a/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/unnamed-chunk-23-1.svg b/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/unnamed-chunk-23-1.svg index 927802d..061c575 100644 --- a/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/unnamed-chunk-23-1.svg +++ b/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/unnamed-chunk-23-1.svg @@ -53,47 +53,44 @@ - - + + - + - + - + - + - + - + - + - + - + - + - - - @@ -141,246 +138,206 @@ - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - + + + + + + + + + + + - + - - + + - - - - + + + + - - - + + + - - - + + + - - - - - - - - + + + + + + + + - - - + + + - - - + + + - - - + + + - + - - - - - - - + + + - - - - - - - + + + - - - - - - - + + + - - - - - - - + + + - - - - - - - + + + - - - - - - - + + + - - - - - - - + + + - - - - - - - + + + - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + @@ -397,21 +354,21 @@ - + - - - + + + - + - - - + + + - + diff --git a/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/unnamed-chunk-28-1.svg b/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/unnamed-chunk-28-1.svg new file mode 100644 index 0000000..b8367eb --- /dev/null +++ b/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/unnamed-chunk-28-1.svg @@ -0,0 +1,262 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/unnamed-chunk-29-1.svg b/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/unnamed-chunk-29-1.svg new file mode 100644 index 0000000..cfd596a --- /dev/null +++ b/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/unnamed-chunk-29-1.svg @@ -0,0 +1,207 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/unnamed-chunk-6-1.svg b/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/unnamed-chunk-6-1.svg index 8a74cbd..a4a61ce 100644 --- a/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/unnamed-chunk-6-1.svg +++ b/notebook/_posts/2021-08-03-simulate-regression-example/simulate-regression-example_files/figure-html5/unnamed-chunk-6-1.svg @@ -11,52 +11,40 @@ - + - - - - - - - - - - + - + - + - + - + - + - + - + - + - - - @@ -103,669 +91,629 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + - - - - - - - + + + - - - - - - + + - - - - - - + + - - - - - - + + - - - - - - + + - - - - - - + + - - - - - - + + - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - - + + + + + - - - - - - - - - - + + + + + + + + + + @@ -779,9 +727,9 @@ - + - +