human-microbiome-compendium/increasing_size_analysis.R
2026-01-28 15:55:17 +01:00

30 lines
780 B
R

library(ggplot2)
library(here)
library(tidyverse)
library(stringr)
flist <- list.files(here("results/increasing_size/"), full.names = TRUE) |> str_sort(numeric = TRUE)
res_df <- do.call("rbind", lapply(flist, readRDS))
reslm <- lm(time ~ n2, data = res_df)
summary(reslm)
res2 <- lm(time ~ I(n2^2), data = res_df)
summary(res2)
resexp <- lm(log(time) ~ n2, data = res_df)
summary(resexp)
library(ggpmisc)
p <- ggplot(res_df, aes(x = n2, y = time)) +
geom_point() +
stat_smooth(method = "lm", formula = y ~ I(x^2)) +
stat_poly_eq(parse = T, aes(label = after_stat(eq.label)), formula = y ~ I(x^2))
ggsave(filename = tempfile(fileext = ".png"), plot = p)
# stat_smooth(method = "lm", formula = y ~ x)
ggplot(res_df, aes(x = n2, y = ari_col)) +
geom_point()