Skip to content

Commit cfe7711

Browse files
authored
Merge pull request #641 from yoshidk6/fix_docs
Fix documentations to address CRAN NOTEs
2 parents 2ec70ba + e9e164a commit cfe7711

17 files changed

Lines changed: 41 additions & 18 deletions

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,4 @@ UseLTO: true
7676
NeedsCompilation: yes
7777
URL: https://mc-stan.org/rstanarm/, https://discourse.mc-stan.org
7878
BugReports: https://github.com/stan-dev/rstanarm/issues
79-
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(reformulas,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_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)

R/loo-prediction.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ loo_predictive_interval.stanreg <-
155155

156156
# internal ----------------------------------------------------------------
157157

158+
#' @exportS3Method NULL
158159
psis.stanreg <- function(log_ratios, ...) {
159160
object <- log_ratios
160161
message("Running PSIS to compute weights...")

R/loo.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#'
2020
#' @description For models fit using MCMC, compute approximate leave-one-out
2121
#' cross-validation (LOO, LOOIC) or, less preferably, the Widely Applicable
22-
#' Information Criterion (WAIC) using the \pkg{\link[=loo-package]{loo}}
22+
#' Information Criterion (WAIC) using the \pkg{\link[loo:loo-package]{loo}}
2323
#' package. (For \eqn{K}-fold cross-validation see \code{\link{kfold.stanreg}}.)
2424
#' Functions for model comparison, and model weighting/averaging are also
2525
#' provided.
@@ -74,7 +74,7 @@
7474
#' package).
7575
#'
7676
#' @section Approximate LOO CV: The \code{loo} method for stanreg objects
77-
#' provides an interface to the \pkg{\link[=loo-package]{loo}} package for
77+
#' provides an interface to the \pkg{\link[loo:loo-package]{loo}} package for
7878
#' approximate leave-one-out cross-validation (LOO). The LOO Information
7979
#' Criterion (LOOIC) has the same purpose as the Akaike Information Criterion
8080
#' (AIC) that is used by frequentists. Both are intended to estimate the
@@ -96,7 +96,7 @@
9696
#' observations. Warnings about Pareto \eqn{k} estimates indicate observations
9797
#' for which the approximation to LOO is problematic (this is described in
9898
#' detail in Vehtari, Gelman, and Gabry (2017) and the
99-
#' \pkg{\link[=loo-package]{loo}} package documentation). The
99+
#' \pkg{\link[loo:loo-package]{loo}} package documentation). The
100100
#' \code{k_threshold} argument can be used to set the \eqn{k} value above
101101
#' which an observation is flagged. If \code{k_threshold} is not \code{NULL}
102102
#' and there are \eqn{J} observations with \eqn{k} estimates above

R/misc.R

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,16 +545,19 @@ set_prior_scale <- function(scale, default, link) {
545545
# @param x Predictor matrix.
546546
# @param offset Optional offset vector.
547547
# @return A vector or matrix.
548+
#' @noRd
548549
linear_predictor <- function(beta, x, offset = NULL) {
549550
UseMethod("linear_predictor")
550551
}
552+
#' @exportS3Method NULL
551553
linear_predictor.default <- function(beta, x, offset = NULL) {
552554
eta <- as.vector(if (NCOL(x) == 1L) x * beta else x %*% beta)
553555
if (length(offset))
554556
eta <- eta + offset
555557

556558
return(eta)
557559
}
560+
#' @exportS3Method NULL
558561
linear_predictor.matrix <- function(beta, x, offset = NULL) {
559562
if (NCOL(beta) == 1L)
560563
beta <- as.matrix(beta)
@@ -630,19 +633,24 @@ get_z.stanmvreg <- function(object, m = NULL, ...) {
630633
# @param x A stanreg object, family object, or string.
631634
# @param ... Other arguments passed to methods. For a \code{stanmvreg} object
632635
# this can be an integer \code{m} specifying the submodel.
633-
# @return The inverse link function associated with x.
636+
# @return The inverse link function associated with x
637+
#' @noRd
634638
linkinv <- function(x, ...) UseMethod("linkinv")
639+
#' @exportS3Method NULL
635640
linkinv.stanreg <- function(x, ...) {
636641
if (is(x, "polr")) polr_linkinv(x) else family(x)$linkinv
637642
}
643+
#' @exportS3Method NULL
638644
linkinv.stanmvreg <- function(x, m = NULL, ...) {
639645
ret <- lapply(family(x), `[[`, "linkinv")
640646
stub <- get_stub(x)
641647
if (!is.null(m)) ret[[m]] else list_nms(ret, stub = stub)
642648
}
649+
#' @exportS3Method NULL
643650
linkinv.family <- function(x, ...) {
644651
x$linkinv
645652
}
653+
#' @exportS3Method NULL
646654
linkinv.character <- function(x, ...) {
647655
stopifnot(length(x) == 1)
648656
polr_linkinv(x)

R/plots.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#'
2020
#' The \code{plot} method for \link{stanreg-objects} provides a convenient
2121
#' interface to the \link[bayesplot:MCMC-overview]{MCMC} module in the
22-
#' \pkg{\link{bayesplot}} package for plotting MCMC draws and diagnostics. It is also
22+
#' \pkg{\link[bayesplot:bayesplot-package]{bayesplot}} package for plotting MCMC draws and diagnostics. It is also
2323
#' straightforward to use the functions from the \pkg{bayesplot} package directly rather than
2424
#' via the \code{plot} method. Examples of both methods of plotting are given
2525
#' below.

0 commit comments

Comments
 (0)