Skip to content

Commit ad66b11

Browse files
committed
fix merge conflict
2 parents 4527cc3 + 5e7d6f8 commit ad66b11

100 files changed

Lines changed: 8745 additions & 119 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/R-CMD-check.yaml

Lines changed: 12 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -12,63 +12,34 @@ name: R-CMD-check
1212

1313
jobs:
1414
R-CMD-check:
15-
runs-on: ${{ matrix.config.os }}
15+
runs-on: ${{ matrix.os }}
1616

17-
name: ${{ matrix.config.rstan }} RStan - ${{ matrix.config.os }} (${{ matrix.config.r }})
17+
name: R CMD CHECK - ${{ matrix.os }} (${{ matrix.r }})
1818

1919
strategy:
2020
fail-fast: false
2121
matrix:
22-
config:
23-
- {os: macOS-latest, r: 'devel', rstan: 'CRAN'}
24-
- {os: macOS-latest, r: 'release', rstan: 'CRAN'}
25-
- {os: windows-latest, r: 'devel', rstan: 'CRAN'}
26-
- {os: windows-latest, r: 'release', rstan: 'CRAN'}
27-
- {os: ubuntu-latest, r: 'devel', rstan: 'CRAN'}
28-
- {os: ubuntu-latest, r: 'release', rstan: 'CRAN'}
29-
- {os: ubuntu-latest, r: 'oldrel', rstan: 'CRAN'}
30-
31-
- {os: macOS-latest, r: 'release', rstan: 'Preview'}
32-
- {os: windows-latest, r: 'release', rstan: 'Preview'}
22+
os: [macOS-latest, windows-latest, ubuntu-latest, ubuntu-24.04-arm]
23+
r: ['devel', 'release', 'oldrel']
3324
env:
3425
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
35-
RSPM: ${{ matrix.config.rspm }}
3626
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
27+
TESTTHAT_CPUS: 4
3728

3829
steps:
39-
- uses: n1hility/cancel-previous-runs@v2
30+
- uses: n1hility/cancel-previous-runs@master
4031
with:
4132
token: ${{ secrets.GITHUB_TOKEN }}
42-
workflow: R-CMD-check.yaml
4333
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master'"
4434

45-
- uses: actions/checkout@v3
35+
- uses: actions/checkout@main
4636

47-
- uses: r-lib/actions/setup-r@v2
37+
- uses: r-lib/actions/setup-r@v2-branch
4838
with:
49-
r-version: ${{ matrix.config.r }}
39+
r-version: ${{ matrix.r }}
5040

51-
- uses: r-lib/actions/setup-pandoc@v2
52-
- uses: r-lib/actions/setup-r-dependencies@v2
41+
- uses: r-lib/actions/setup-pandoc@v2-branch
42+
- uses: r-lib/actions/setup-r-dependencies@v2-branch
5343
with:
54-
cache-version: 2
5544
extra-packages: any::rcmdcheck any::betareg any::HSAUR3 any::biglm any::gamm4 any::V8
56-
57-
- name: Install RStan Preview if Needed
58-
run: |
59-
if ("${{ matrix.config.rstan }}" == "Preview") {
60-
install.packages("rstan", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
61-
}
62-
shell: Rscript {0}
63-
64-
- uses: r-lib/actions/check-r-package@v2
65-
with:
66-
args: 'c("--no-manual", "--as-cran", "--ignore-vignettes")'
67-
build_args: '"--no-build-vignettes"'
68-
69-
- name: Upload check results
70-
if: failure()
71-
uses: actions/upload-artifact@main
72-
with:
73-
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
74-
path: check
45+
- uses: r-lib/actions/check-r-package@v2-branch

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,15 @@ src/stan_files/*.hpp
88
src/rstanarm.so
99
src/rstanarm.dll
1010
src/init.o
11-
man/*.Rd
1211
!man/rstanarm-internal.Rd
1312
vignettes/*.R
1413
!vignettes/*.Rmd
1514
vignettes/*.html
1615
vignettes/*_files
1716
.DS_Store
1817
revdep/*
18+
*.o
19+
*.cc
20+
*.h
21+
src/Makevars
22+
R/stanmodels.R

DESCRIPTION

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ Imports:
4848
stats,
4949
survival (>= 2.40.1),
5050
RcppParallel (>= 5.0.1),
51-
utils
51+
utils,
52+
reformulas
5253
Suggests:
5354
biglm,
5455
betareg,
@@ -75,4 +76,4 @@ UseLTO: true
7576
NeedsCompilation: yes
7677
URL: https://mc-stan.org/rstanarm/, https://discourse.mc-stan.org
7778
BugReports: https://github.com/stan-dev/rstanarm/issues
78-
RoxygenNote: 7.2.3
79+
RoxygenNote: 7.3.2

NAMESPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ importFrom(ggplot2,scale_x_discrete)
229229
importFrom(ggplot2,theme)
230230
importFrom(ggplot2,theme_bw)
231231
importFrom(ggplot2,xlab)
232-
importFrom(lme4,findbars)
233232
importFrom(lme4,fixef)
234233
importFrom(lme4,glFormula)
235234
importFrom(lme4,glmer)
@@ -262,6 +261,7 @@ importFrom(posterior,as_draws_df)
262261
importFrom(posterior,as_draws_list)
263262
importFrom(posterior,as_draws_matrix)
264263
importFrom(posterior,as_draws_rvars)
264+
importFrom(reformulas,findbars)
265265
importFrom(rstan,constrain_pars)
266266
importFrom(rstan,extract)
267267
importFrom(rstan,extract_sparse_parts)

R/doc-rstanarm-package.R

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717

1818
#' Applied Regression Modeling via RStan
1919
#'
20-
#' @docType package
21-
#' @name rstanarm-package
22-
#' @aliases rstanarm
2320
#' @useDynLib rstanarm, .registration = TRUE
2421
#'
2522
#' @import methods
@@ -104,4 +101,4 @@
104101
#' @template reference-bayesvis
105102
#' @template reference-muth
106103
#'
107-
NULL
104+
"_PACKAGE"

R/jm_data_block.R

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,13 @@ reformulate_lhs <- function(x) {
148148
# Reformulate an expression as the RHS of a model formula
149149
#
150150
# @param x The expression to reformulate
151-
# @param subbars A logical specifying whether to call lme4::subbars
151+
# @param subbars A logical specifying whether to call reformulas::subbars
152152
# on the result
153153
# @return A model formula
154154
reformulate_rhs <- function(x, subbars = FALSE) {
155155
fm <- formula(substitute(~ RHS, list(RHS = x)))
156156
if (subbars) {
157-
lme4::subbars(fm)
157+
reformulas::subbars(fm)
158158
} else {
159159
fm
160160
}
@@ -579,7 +579,7 @@ rename_t_and_cauchy <- function(prior_stuff, has) {
579579
# has_aux: logical specifying whether the glmer submodel
580580
# requires an auxiliary parameter.
581581
handle_y_mod <- function(formula, data, family) {
582-
mf <- stats::model.frame(lme4::subbars(formula), data)
582+
mf <- stats::model.frame(reformulas::subbars(formula), data)
583583
if (!length(formula) == 3L)
584584
stop2("An outcome variable must be specified.")
585585

@@ -647,7 +647,7 @@ make_y_for_stan <- function(formula, model_frame, family) {
647647
# N,K: number of rows (observations) and columns (predictors) in the
648648
# fixed effects model matrix
649649
make_x_for_stan <- function(formula, model_frame) {
650-
x_form <- lme4::nobars(formula)
650+
x_form <- reformulas::nobars(formula)
651651
x <- model.matrix(x_form, model_frame)
652652
has_intercept <- check_for_intercept(x, logical = TRUE)
653653
xtemp <- drop_intercept(x)
@@ -680,7 +680,7 @@ make_x_for_stan <- function(formula, model_frame) {
680680
# grouping factor
681681
# ngrps: a vector with the number of groups for each grouping factor
682682
make_z_for_stan <- function(formula, model_frame) {
683-
bars <- lme4::findbars(formula)
683+
bars <- reformulas::findbars(formula)
684684
if (length(bars) > 2L)
685685
stop2("A maximum of 2 grouping factors are allowed.")
686686
z_parts <- lapply(bars, split_at_bars)
@@ -816,7 +816,7 @@ append_mvmer_famlink <- function(family, is_bernoulli = FALSE) {
816816
# - the formula part (ie. the formula on the LHS of "|"), and
817817
# - the name of the grouping factor (ie. the variable on the RHS of "|")
818818
#
819-
# @param x Random effects part of a model formula, as returned by lme4::findbars
819+
# @param x Random effects part of a model formula, as returned by reformulas::findbars
820820
# @return A named list with the following elements:
821821
# re_form: a formula specifying the random effects structure
822822
# group_var: the name of the grouping factor
@@ -919,13 +919,13 @@ check_id_list <- function(id_var, y_flist) {
919919
#
920920
# @param terms The existing model frame terms object
921921
# @param formula The formula that was used to build the model frame
922-
# (but prior to having called lme4::subbars on it!)
922+
# (but prior to having called reformulas::subbars on it!)
923923
# @param data The data frame that was used to build the model frame
924924
# @return A terms object with predvars.fixed and predvars.random as
925925
# additional attributes
926926
append_predvars_attribute <- function(terms, formula, data) {
927-
fe_form <- lme4::nobars(formula)
928-
re_form <- lme4::subbars(justRE(formula, response = TRUE))
927+
fe_form <- reformulas::nobars(formula)
928+
re_form <- reformulas::subbars(justRE(formula, response = TRUE))
929929
fe_frame <- stats::model.frame(fe_form, data)
930930
re_frame <- stats::model.frame(re_form, data)
931931
fe_terms <- attr(fe_frame, "terms")
@@ -1587,7 +1587,7 @@ parse_assoc_data <- function(x, user_x) {
15871587
if (identical(length(fm), 3L))
15881588
stop(paste0("Formula specified for '", x, "' association structure should not ",
15891589
"include a response."), call. = FALSE)
1590-
if (length(lme4::findbars(fm)))
1590+
if (length(reformulas::findbars(fm)))
15911591
stop(paste0("Formula specified for '", x, "' association structure should only ",
15921592
"include fixed effects."), call. = FALSE)
15931593
if (fm[[2L]] == 1)

R/jm_make_assoc_parts.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,17 +190,17 @@ make_assoc_parts_for_stan <- function(newdata, y_mod, include_Zt = TRUE) {
190190
# construct model frame using predvars
191191
formula <- use_predvars(y_mod, keep_response = FALSE)
192192
data <- as.data.frame(newdata)
193-
model_frame <- stats::model.frame(lme4::subbars(formula), data)
193+
model_frame <- stats::model.frame(reformulas::subbars(formula), data)
194194

195195
# fe design matrices
196-
x_form <- lme4::nobars(formula)
196+
x_form <- reformulas::nobars(formula)
197197
x <- model.matrix(x_form, model_frame)
198198
xtemp <- drop_intercept(x)
199199
x_bar <- y_mod$x$x_bar
200200
xtemp <- sweep(xtemp, 2, x_bar, FUN = "-")
201201

202202
# re design matrices
203-
bars <- lme4::findbars(formula)
203+
bars <- reformulas::findbars(formula)
204204
if (length(bars) > 2L)
205205
stop2("A maximum of 2 grouping factors are allowed.")
206206
z_parts <- lapply(bars, split_at_bars)
@@ -214,7 +214,7 @@ make_assoc_parts_for_stan <- function(newdata, y_mod, include_Zt = TRUE) {
214214

215215
# optionally add the sparse Zt matrix
216216
if (include_Zt)
217-
ret$Zt <- lme4::mkReTrms(bars, model_frame)$Zt
217+
ret$Zt <- reformulas::mkReTrms(bars, model_frame)$Zt
218218

219219
# add offset values
220220
if ('offset' %in% colnames(newdata))

R/jm_make_assoc_terms.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,9 +388,11 @@ get_element <- function(parts, m = 1, which = "eta", ...) {
388388
# @param grp_assoc Character string, the function to use to collapse
389389
# across the lower level units clustered within individuals.
390390
# @return A vector or matrix, depending on the method called.
391+
#' @noRd
391392
collapse_within_groups <- function(eta, grp_idx, grp_assoc = "sum") {
392393
UseMethod("collapse_within_groups")
393394
}
395+
#' @exportS3Method NULL
394396
collapse_within_groups.default <- function(eta, grp_idx, grp_assoc) {
395397
N <- nrow(grp_idx)
396398
val <- rep(NA, N)
@@ -400,6 +402,7 @@ collapse_within_groups.default <- function(eta, grp_idx, grp_assoc) {
400402
}
401403
val
402404
}
405+
#' @exportS3Method NULL
403406
collapse_within_groups.matrix <- function(eta, grp_idx, grp_assoc) {
404407
N <- nrow(grp_idx)
405408
val <- matrix(NA, nrow = nrow(eta), ncol = N)

R/launch_shinystan.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
#' used with ShinyStan. The only exception is that ShinyStan does not
4444
#' currently support \pkg{rstanarm} models fit using
4545
#' \code{algorithm='optimizing'}. See the
46-
#' \pkg{\link[=shinystan-package]{shinystan}} package documentation for more
46+
#' \pkg{\link[shinystan:shinystan-package]{shinystan}} package documentation for more
4747
#' information.
4848
#'
4949
#' @section Faster launch times:

R/log_lik.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,9 @@ ll_fun <- function(x, m = NULL) {
200200
# just a single MCMC draw).
201201
# @return a named list with elements data, draws, S (posterior sample size) and
202202
# N = number of observations
203+
#' @noRd
203204
ll_args <- function(object, ...) UseMethod("ll_args")
205+
#' @exportS3Method NULL
204206
ll_args.stanreg <- function(object, newdata = NULL, offset = NULL, m = NULL,
205207
reloo_or_kfold = FALSE, ...) {
206208
validate_stanreg_object(object)
@@ -511,6 +513,7 @@ ll_args.stanreg <- function(object, newdata = NULL, offset = NULL, m = NULL,
511513
# @param pars Output from extract_pars
512514
# @param m Integer specifying which submodel
513515
# @param reloo_or_kfold logical. TRUE if ll_args is for reloo or kfold
516+
#' @exportS3Method NULL
514517
ll_args.stanjm <- function(object, data, pars, m = 1,
515518
reloo_or_kfold = FALSE, ...) {
516519
validate_stanjm_object(object)
@@ -863,10 +866,12 @@ evaluate_log_basehaz <- function(times, basehaz, coefs) {
863866
# at which the log hazard was evaluated for each individual.
864867
# @param qwts A vector of unstandardised GK quadrature weights.
865868
# @return A vector or matrix of log survival probabilities.
869+
#' @noRd
866870
evaluate_log_survival <- function(log_haz, qnodes, qwts) {
867871
UseMethod("evaluate_log_survival")
868872
}
869873

874+
#' @exportS3Method NULL
870875
evaluate_log_survival.default <- function(log_haz, qnodes, qwts) {
871876
# convert log hazard to hazard
872877
haz <- exp(log_haz)
@@ -879,6 +884,7 @@ evaluate_log_survival.default <- function(log_haz, qnodes, qwts) {
879884
-cum_haz
880885
}
881886

887+
#' @exportS3Method NULL
882888
evaluate_log_survival.matrix <- function(log_haz, qnodes, qwts) {
883889
# convert log hazard to hazard
884890
haz <- exp(log_haz)

0 commit comments

Comments
 (0)