add first scripts for plotting the singular value

This commit is contained in:
Niclas
2026-01-26 14:38:22 +01:00
parent b18113a0ea
commit c2c759bb04

39
scripts/plot_sv.R Normal file
View File

@@ -0,0 +1,39 @@
# Load function ----------------------------------------------------------------
source(here::here("R", "singular_values.R"))
source(here::here("R", "graphon_distribution.R"))
source(here::here("R", "singular_value_plot.R"))
# Nearly match with sample function --------------------------------------------
# v ~ N(0,1) and X ~ discrete Uniform on [1:n]
smallest_sv_sequence(
a = c(0.5),
n = 400,
maxK= 20,
sampler_fn = sample,
guard=1e-12,
plot=TRUE,
curve_expr = quote(20 / sqrt(x))
)
# Normally distributed X ~ N(0,1) and v ~ N(0,1) -------------------------------
smallest_sv_sequence(
a = c(0.5),
n = 400,
maxK = 20,
sampler_fn =function(n) matrix(rnorm(n), ncol = 1L),
guard=1e-12,
plot=TRUE,
log_plot = TRUE,
curve_expr = quote(20 / exp(x^1.32))
)
# Uniform distributed X ~ U[0,1] and v ~ N(0,1) --------------------------------
smallest_sv_sequence(
a = c(0.5),
n = 400,
maxK = 20,
sampler_fn =function(n) matrix(runif(n), ncol = 1L),
guard=1e-12,
plot=TRUE,
curve_expr = quote(20 / x^2)
)