Skip to content

Commit

Permalink
Remove rstan namespace imports
Browse files Browse the repository at this point in the history
  • Loading branch information
gowerc committed Jan 16, 2024
1 parent 5011a3d commit aa9af31
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
3 changes: 0 additions & 3 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ import(R6)
import(methods)
importFrom(assertthat,assert_that)
importFrom(mmrm,VarCorr)
importFrom(rstan,extract)
importFrom(rstan,sampling)
importFrom(rstan,summary)
importFrom(stats,as.formula)
importFrom(stats,binomial)
importFrom(stats,coef)
Expand Down
7 changes: 2 additions & 5 deletions R/mcmc.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
#' - `fit`: a `stanfit` object.
#'
#' @import methods
#' @importFrom rstan sampling
fit_mcmc <- function(
designmat,
outcome,
Expand Down Expand Up @@ -122,7 +121,7 @@ fit_mcmc <- function(
sampling_args$seed <- seed

stan_fit <- record({
do.call(sampling, sampling_args)
do.call(rstan::sampling, sampling_args)
})

if (!is.null(stan_fit$errors)) {
Expand Down Expand Up @@ -239,10 +238,9 @@ split_dim <- function(a, n) {
#' of the list is a list with length equal to 1 if `same_cov = TRUE` or equal to the
#' number of groups if `same_cov = FALSE`.
#'
#' @importFrom rstan extract
extract_draws <- function(stan_fit) {

pars <- extract(stan_fit, pars = c("beta", "Sigma"))
pars <- rstan::extract(stan_fit, pars = c("beta", "Sigma"))
names(pars) <- c("beta", "sigma")

##################### from array to list
Expand All @@ -267,7 +265,6 @@ extract_draws <- function(stan_fit) {
#' @return
#' A named vector containing the ESS for each parameter of the model.
#'
#' @importFrom rstan summary
get_ESS <- function(stan_fit) {
return(rstan::summary(stan_fit, pars = c("beta", "Sigma"))$summary[, "n_eff"])
}
Expand Down

0 comments on commit aa9af31

Please sign in to comment.