add first scripts for plotting the singular value
This commit is contained in:
39
scripts/plot_sv.R
Normal file
39
scripts/plot_sv.R
Normal 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)
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user