Finalize knot-placement plot

This commit is contained in:
2025-05-24 19:46:58 +02:00
parent d1c77def49
commit 37b1a68d0c
2 changed files with 3 additions and 4 deletions

View File

@@ -8,7 +8,7 @@ library(readr)
# Creating faceted plots for different knot values and mu values # Creating faceted plots for different knot values and mu values
# Create a function to generate the data for a given number of knots and mu value # Create a function to generate the data for a given number of knots and mu value
generate_basis_data <- function(num_knots, mu_value, sig_value, nonc_value, tailw_value, deg_value) { generate_basis_data <- function(num_knots, mu_value, sig_value, nonc_value, tailw_value, deg_value) {
grid <- seq(from = 0.01, to = 0.99, length.out = 50) grid <- seq(from = 0, to = 1, length.out = 26)
# Use provided degree # Use provided degree
B <- profoc:::make_basis_matrix(grid, B <- profoc:::make_basis_matrix(grid,
profoc::make_knots( profoc::make_knots(
@@ -21,7 +21,7 @@ generate_basis_data <- function(num_knots, mu_value, sig_value, nonc_value, tail
), ),
deg = deg_value deg = deg_value
) )
B_mat <- round(as.matrix(B), 3) B_mat <- round(as.matrix(B), 5)
df <- as.data.frame(B_mat) df <- as.data.frame(B_mat)
df$x <- grid df$x <- grid
df_long <- pivot_longer(df, df_long <- pivot_longer(df,
@@ -49,7 +49,6 @@ all_data <- list()
counter <- 1 counter <- 1
# Nested loops to cover all parameter combinations # Nested loops to cover all parameter combinations
print(paste("Processing knots:", k))
for (m in mu_values) { for (m in mu_values) {
print(paste("Processing mu:", m)) print(paste("Processing mu:", m))
for (s in sig_values) { for (s in sig_values) {

View File

@@ -2320,7 +2320,7 @@ chart = {
const line = d3.line() const line = d3.line()
.x(d => x(d.x)) .x(d => x(d.x))
.y(d => y(d.y)) .y(d => y(d.y))
.curve(d3.curveLinear); .curve(d3.curveBasis);
// Group to contain the basis function lines // Group to contain the basis function lines
const linesGroup = g.append("g") const linesGroup = g.append("g")