# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

library(tidyverse)
library(ggpubr)
library(rstatix)

install.packages("dplyr")

install.packages("ggpubr")

res_25_0 = read.csv("results/25_0.csv")
res_25_75 = read.csv("results/25_75.csv")
res_50_0 = read.csv("results/50_0.csv")
res_50_50 = read.csv("results/50_50.csv")
res_75_0 = read.csv("results/75_0.csv")
res_75_25 = read.csv("results/75_25.csv")
res_100_0 = read.csv("results/100_0.csv")

data <- rbind(res_25_0, res_25_75, res_50_0, res_50_50, res_75_0, res_75_25, res_100_0)
data$real_data <- as.factor(data$real_data)
data$synth <- as.factor(data$synth)

boxplot(WER ~ real_data * synth, data=data)

boxplot(CER ~ real_data * synth, data=data)

model <- lm(WER ~ real_data * synth, data=data)

res <- anova(model)

res

# Check the homogeneity of variance assumption
plot(res, 1)

# Check the normality assumpttion in residuals
plot(res, 2)

# Extract the residuals
aov_residuals <- residuals(object = res)
# Run Shapiro-Wilk test
shapiro.test(x = aov_residuals )

qqnorm(res_25_0$WER)
qqline(res_25_0$WER)

qqnorm(res_25_0$CER)
qqline(res_25_0$CER)

model <- lm(CER ~ real_data, data=data)
anova(model)

model <- lm(CER ~ synth, data=data)
anova(model)

model <- lm(CER ~ real_data * synth, data=data)
anova(model)

interaction.plot(data$real_data, data$synth)

interaction.plot(data$real_data, data$synth, data$WER, ylab="WER", xlab="% of real data set", trace.label="+ synth")

# ?boxplot

boxplot(WER ~ real_data + synth, data=data, at=c(0, 3, 5, 7, 1, 4, 6, 9))



StarcoderdataJupyterScriptsDedupFiltered