1
0
mw-lifecycle-analysis/dsl/final_bivariate.R
2025-11-10 14:32:14 -08:00

74 lines
1.6 KiB
R

library(tidyverse)
#library(dsl)
library(dplyr)
dsl_csv <-"~/dsl/110925_DSL_df_adac.csv"
dsl_df <- read.csv(dsl_csv, header = TRUE)
outcome_summary <- dsl_df |>
group_by(source, isAuthorWMF)|>
summarise(
total_sum = sum(!is.na(resolution_outcome)),
count_resolution_outcome = sum(resolution_outcome),
success_prop = count_resolution_outcome / total_sum,
median_ttr_days = median(TTR, na.rm = TRUE) / 24,
median_comments_before_resolution = median(n_comments_before)
)
library(ggplot2)
library(ggdist)
ggplot(
dsl_df,
aes(
x=n_comments_before,
color=source,
fill=source
)
) +
facet_grid(~isAuthorWMF) +
stat_halfeye() +
theme_minimal()
dsl_df <- dsl_df |>
mutate(priority = factor(priority,
levels = c("Unbreak Now!", "High", "Medium", "Low", "Lowest", "Needs Triage")))
ggplot(dsl_df,
aes(
fill=resolution_outcome,
x=priority
)) +
facet_grid(~source) +
geom_bar() +
theme_minimal()
signed_power <- function(x, p) {
sign(x) * abs(x) ^ p
}
signed_log <- function(x) sign(x) * log1p(abs(x))
dsl_df <- dsl_df |>
mutate(
sp_med_pc3_adac = signed_power(median_PC3_adac, 0.2),
sp_med_pc4_adac = signed_power(median_PC4_adac, 0.2),
sl_med_pc4_adac = signed_log(median_PC4_adac),
sl_med_pc3_adac = signed_log(median_PC3_adac)
)
ggplot(dsl_df, aes(
y= log1p(TTR/24),
x=sl_med_pc4_adac,
shape=isAuthorWMF,
color=isAuthorWMF
)) +
facet_grid(~source) +
theme_minimal() +
geom_smooth(method="loess", span=0.5) +
geom_point() +
scale_color_viridis_d()