Simplify data basis
This commit is contained in:
5
test.R
5
test.R
@@ -8,7 +8,8 @@ library(readr)
|
||||
# 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
|
||||
generate_basis_data <- function(num_knots, mu_value) {
|
||||
B <- profoc:::make_basis_matrix(1:99 / 100,
|
||||
grid <- seq(0, 1, length.out = 20)
|
||||
B <- profoc:::make_basis_matrix(grid,
|
||||
profoc::make_knots(
|
||||
n = num_knots,
|
||||
mu = mu_value,
|
||||
@@ -19,7 +20,7 @@ generate_basis_data <- function(num_knots, mu_value) {
|
||||
deg = 3
|
||||
)
|
||||
df <- as.data.frame(as.matrix(B))
|
||||
df$x <- 1:99 / 100
|
||||
df$x <- grid
|
||||
df_long <- pivot_longer(df,
|
||||
cols = -x,
|
||||
names_to = "b",
|
||||
|
||||
Reference in New Issue
Block a user