From 9aac90d045a386cc3a2ce03f1d8e48107e84aad4 Mon Sep 17 00:00:00 2001 From: huizezhang-sherry Date: Wed, 18 Sep 2024 11:40:00 -0500 Subject: [PATCH] use random bases directly at locs for calculating smoothness --- R/calc-squintability.R | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/R/calc-squintability.R b/R/calc-squintability.R index b164e2e..a6b6cb3 100644 --- a/R/calc-squintability.R +++ b/R/calc-squintability.R @@ -171,9 +171,11 @@ calc_smoothness <- function(basis_df, start_params = c(0.001, 0.5, 2, 2), # construct gp cli::cli_inform("Fitting a GP model ...") if (verbose) {silent <- FALSE} else {silent <- TRUE} - gp_params <- list(y = basis_df[["index"]], locs = basis_df[["dist"]], - X = as.matrix(rep(1,nrow(basis_df))), - start_parms = start_params, covfun_name = "matern_isotropic", + locs <- purrr::map(basis_df[["basis"]], as.vector) |> purrr::reduce(rbind) + gp_params <- list(y = basis_df[["index"]], locs = locs, + X = rep(1,nrow(basis_df)), + start_parms = start_params, + covfun_name = "matern_isotropic", silent = silent, other_gp_params )