diff --git a/R/backends.R b/R/backends.R index 6870355c..afa082f7 100644 --- a/R/backends.R +++ b/R/backends.R @@ -638,10 +638,10 @@ read_csv_as_stanfit <- function(files, variables = NULL, # Can make LV models slightly more efficient by not filling in zeros in a loop if(any(grepl('lv_coefs_raw[i, j] = 0;', stan_file, fixed = TRUE))){ - starts <- mvgam:::grepws('lv_coefs_raw[i, j] = 0;', stan_file) - 2 - ends <- mvgam:::grepws('lv_coefs_raw[i, j] = 0;', stan_file) + 2 + starts <- grepws('lv_coefs_raw[i, j] = 0;', stan_file) - 2 + ends <- grepws('lv_coefs_raw[i, j] = 0;', stan_file) + 2 stan_file <- stan_file[-c(starts:ends)] - stan_file[mvgam:::grepws('matrix[n_series, n_lv] lv_coefs_raw;', stan_file)] <- + stan_file[grepws('matrix[n_series, n_lv] lv_coefs_raw;', stan_file)] <- 'matrix[n_series, n_lv] lv_coefs_raw = rep_matrix(0, n_series, n_lv);' } diff --git a/R/globals.R b/R/globals.R index 7ca4e689..f96b230e 100644 --- a/R/globals.R +++ b/R/globals.R @@ -17,4 +17,4 @@ utils::globalVariables(c("y", "year", "smooth_vals", "smooth_num", "name", "needed", "nmix_trendmap", "orig_formula", "trial", "use_var1", "use_var1cor", "xcols_drop", "time_lag", "dis_time", "maxt", "orig_rows", - "matches", "time.", "file_name")) + "matches", "time.", "file_name", ".data")) diff --git a/R/monotonic.R b/R/monotonic.R index 2e29031b..4d2fd93b 100644 --- a/R/monotonic.R +++ b/R/monotonic.R @@ -503,7 +503,7 @@ eval_smoothDotmodDotsmooth = function(smooth, # set some values to NA if too far from the data if (gratia::smooth_dim(smooth) == 2L && (!is.null(dist) && dist > 0)) { - eval_sm <- too_far_to_na(smooth, + eval_sm <- gratia::too_far_to_na(smooth, input = eval_sm, reference = model[["model"]], cols = c(".estimate", ".se"), @@ -561,7 +561,7 @@ eval_smoothDotmoiDotsmooth = function(smooth, # set some values to NA if too far from the data if (gratia::smooth_dim(smooth) == 2L && (!is.null(dist) && dist > 0)) { - eval_sm <- too_far_to_na(smooth, + eval_sm <- gratia::too_far_to_na(smooth, input = eval_sm, reference = model[["model"]], cols = c(".estimate", ".se"), @@ -626,7 +626,7 @@ eval_smoothDotmoiDotsmooth = function(smooth, ## if this is a by variable, filter the by variable for the required ## level now if (gratia::is_factor_by_smooth(smooth)) { - data <- data %>% filter(.data[[by_var]] == gratia::by_level(smooth)) + data <- data %>% dplyr::filter(.data[[by_var]] == gratia::by_level(smooth)) } } data diff --git a/R/stan_utils.R b/R/stan_utils.R index 23e7525c..9ceb478b 100644 --- a/R/stan_utils.R +++ b/R/stan_utils.R @@ -36,14 +36,14 @@ print.mvgammodel = function(x, ...){ #' @export #' @importFrom brms stancode #' @rdname code -stancode.mvgam_prefit = function(object){ +stancode.mvgam_prefit = function(object, ...){ code(object) } #' @export #' @rdname code -stancode.mvgam = function(object){ +stancode.mvgam = function(object, ...){ code(object) } diff --git a/man/code.Rd b/man/code.Rd index 468be096..f0e21e20 100644 --- a/man/code.Rd +++ b/man/code.Rd @@ -8,9 +8,9 @@ \usage{ code(object) -\method{stancode}{mvgam_prefit}(object) +\method{stancode}{mvgam_prefit}(object, ...) -\method{stancode}{mvgam}(object) +\method{stancode}{mvgam}(object, ...) } \arguments{ \item{object}{An object of class \code{mvgam} or \code{mvgam_prefit}, diff --git a/man/mvgam_marginaleffects.Rd b/man/mvgam_marginaleffects.Rd index 5564cfdb..16e6648e 100644 --- a/man/mvgam_marginaleffects.Rd +++ b/man/mvgam_marginaleffects.Rd @@ -86,6 +86,8 @@ arguments.} \item \code{newdata = datagrid(cyl = c(4, 6))}: \code{cyl} variable equal to 4 and 6 and other regressors fixed at their means or modes. \item See the Examples section and the \code{\link[marginaleffects:datagrid]{datagrid()}} documentation. } +\item \code{\link[=subset]{subset()}} call with a single argument to select a subset of the dataset used to fit the model, ex: \code{newdata = subset(treatment == 1)} +\item \code{\link[dplyr:filter]{dplyr::filter()}} call with a single argument to select a subset of the dataset used to fit the model, ex: \code{newdata = filter(treatment == 1)} \item string: \itemize{ \item "mean": Marginal Effects at the Mean. Slopes when each predictor is held at its mean or mode. diff --git a/src/RcppExports.o b/src/RcppExports.o index e8dd19f0..03b01119 100644 Binary files a/src/RcppExports.o and b/src/RcppExports.o differ diff --git a/src/mvgam.dll b/src/mvgam.dll index 24fb715d..4ae626bc 100644 Binary files a/src/mvgam.dll and b/src/mvgam.dll differ diff --git a/src/trend_funs.o b/src/trend_funs.o index 917270cf..1c0d5a8f 100644 Binary files a/src/trend_funs.o and b/src/trend_funs.o differ