Skip to content

Commit 354f828

Browse files
committed
Fix documentation
1 parent 732d3dc commit 354f828

40 files changed

+241
-429
lines changed

DESCRIPTION

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
Package: TruncatedNormal
22
Type: Package
33
Title: Truncated Multivariate Normal and Student Distributions
4-
Version: 2.2.2.9001
5-
Date: 2022-05-13
6-
Authors@R: c(person(given="Zdravko", family="Botev", role = "aut", email = "botev@unsw.edu.au", comment = c(ORCID = "0000-0001-9054-3452")), person(given="Leo", family="Belzile", role = c("aut", "cre"), email = "belzilel@gmail.com", comment = c(ORCID = "0000-0002-9135-014X"))), person(given="Anthony", family="Vankus", role = c("aut", "cre"))
4+
Version: 2.2.4.0001
5+
Authors@R: c(person(given="Zdravko", family="Botev", role = "aut", email = "botev@unsw.edu.au", comment = c(ORCID = "0000-0001-9054-3452")), person(given="Leo", family="Belzile", role = c("aut", "cre"), email = "belzilel@gmail.com", comment = c(ORCID = "0000-0002-9135-014X")))
76
Description: A collection of functions to deal with the truncated univariate and multivariate normal and Student distributions, described in Botev (2017) <doi:10.1111/rssb.12162> and Botev and L'Ecuyer (2015) <doi:10.1109/WSC.2015.7408180>.
87
License: GPL-3
98
BugReports:
@@ -17,7 +16,7 @@ Imports:
1716
LinkingTo:
1817
Rcpp,
1918
RcppArmadillo
20-
RoxygenNote: 7.1.1
19+
RoxygenNote: 7.2.3
2120
VignetteBuilder: knitr
2221
Encoding: UTF-8
2322
Suggests:

R/RcppExports.R

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ lnNpr <- function(a, b, check = TRUE) {
7171
#' @keywords internal
7272
#' @return a list with components
7373
#' \itemize{
74-
#' \item{\code{L}: }{Cholesky root}
75-
#' \item{\code{l}: }{permuted vector of lower bounds}
76-
#' \item{\code{u}: }{permuted vector of upper bounds}
77-
#' \item{\code{perm}: }{vector of integers with ordering of permutation}
74+
#' \item \code{L}: Cholesky root
75+
#' \item \code{l}: permuted vector of lower bounds
76+
#' \item \code{u}: permuted vector of upper bounds
77+
#' \item \code{perm}: vector of integers with ordering of permutation
7878
#' }
7979
#' @references Genz, A. and Bretz, F. (2009). Computations of Multivariate Normal and t Probabilities, volume 105. Springer, Dordrecht.
8080
#' @references Gibson G.J., Glasbey C.A. and D.A. Elton (1994). Monte Carlo evaluation of multivariate normal integrals and sensitivity to variate ordering. In: Dimon et al., Advances in Numerical Methods and Applications, WSP, pp. 120-126.
@@ -99,10 +99,10 @@ lnNpr <- function(a, b, check = TRUE) {
9999
#' @keywords internal
100100
#' @return a list with components
101101
#' \itemize{
102-
#' \item{\code{L}: }{Cholesky root}
103-
#' \item{\code{l}: }{permuted vector of lower bounds}
104-
#' \item{\code{u}: }{permuted vector of upper bounds}
105-
#' \item{\code{perm}: }{vector of integers with ordering of permutation}
102+
#' \item \code{L}: Cholesky root
103+
#' \item \code{l}: permuted vector of lower bounds
104+
#' \item \code{u}: permuted vector of upper bounds
105+
#' \item \code{perm}: vector of integers with ordering of permutation
106106
#' }
107107
#' @references Genz, A. and Bretz, F. (2009). Computations of Multivariate Normal and t Probabilities, volume 105. Springer, Dordrecht.
108108
#' @references Gibson G.J., Glasbey C.A. and D.A. Elton (1994). Monte Carlo evaluation of multivariate normal integrals and sensitivity to variate ordering. In: Dimon et al., Advances in Numerical Methods and Applications, WSP, pp. 120-126.

R/cholperm.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
#' @param method string indicating which method to use. Default to \code{"GGE"}
1616
#' @return a list with components
1717
#' \itemize{
18-
#' \item{\code{L}: }{Cholesky root}
19-
#' \item{\code{l}: }{permuted vector of lower bounds}
20-
#' \item{\code{u}: }{permuted vector of upper bounds}
21-
#' \item{\code{perm}: }{vector of integers with ordering of permutation}
18+
#' \item \code{L}: Cholesky root
19+
#' \item \code{l}: permuted vector of lower bounds
20+
#' \item \code{u}: permuted vector of upper bounds
21+
#' \item \code{perm}: vector of integers with ordering of permutation
2222
#' }
2323
#' @export
2424
#' @references Genz, A. and Bretz, F. (2009). Computations of Multivariate Normal and t Probabilities, volume 105. Springer, Dordrecht.
@@ -30,4 +30,4 @@ cholperm <- function(Sigma, l, u, method = c("GGE", "GB")){
3030
} else{
3131
.cholpermGB(Sigma = Sigma, l = l, u = u)
3232
}
33-
}
33+
}

R/mvNcdf.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
#' where \eqn{Y} is drawn from \eqn{N(0, A\Sigma A^\top)}.
2020
#' @return a list with components
2121
#' \itemize{
22-
#' \item{\code{prob}: }{estimated value of probability Pr\eqn{(l<X<u)}}
23-
#' \item{\code{relErr}: }{estimated relative error of estimator}
24-
#' \item{\code{upbnd}: }{ theoretical upper bound on true Pr\eqn{(l<X<u)}}
22+
#' \item\code{prob}: estimated value of probability Pr\eqn{(l<X<u)}
23+
#' \item\code{relErr}: estimated relative error of estimator
24+
#' \item\code{upbnd}: theoretical upper bound on true Pr\eqn{(l<X<u)}
2525
#' }
2626
#' @author Zdravko I. Botev
2727
#' @export

R/mvNqmc.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
#' where \eqn{Y} is drawn from \eqn{N(0, A\Sigma A^\top)}.
1717
#' @return a list with components
1818
#' \itemize{
19-
#' \item{\code{prob}: }{estimated value of probability Pr\eqn{(l<X<u)}}
20-
#' \item{\code{relErr}: }{estimated relative error of estimator}
21-
#' \item{\code{upbnd}: }{ theoretical upper bound on true Pr\eqn{(l<X<u)}}
19+
#' \item \code{prob}: estimated value of probability Pr\eqn{(l<X<u)}
20+
#' \item \code{relErr}: estimated relative error of estimator
21+
#' \item \code{upbnd}: theoretical upper bound on true Pr\eqn{(l<X<u)}
2222
#' }
2323
#' @author Zdravko I. Botev
2424
#' @references Z. I. Botev (2017), \emph{The Normal Law Under Linear Restrictions:

R/mvTcdf.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
#' @inheritParams mvrandt
1212
#' @return a list with components
1313
#' \itemize{
14-
#' \item{\code{prob}: }{estimated value of probability Pr\eqn{(l<X<u)} }
15-
#' \item{\code{relErr}: }{estimated relative error of estimator}
16-
#' \item{\code{upbnd}: }{theoretical upper bound on true Pr\eqn{(l<X<u)} }
14+
#' \item \code{prob}: estimated value of probability Pr\eqn{(l<X<u)}
15+
#' \item \code{relErr}: estimated relative error of estimator
16+
#' \item \code{upbnd}: theoretical upper bound on true Pr\eqn{(l<X<u)}
1717
#'}
1818
#' @note If you want to estimate Pr\eqn{(l<Y<u)},
1919
#' where \eqn{Y} follows a Student distribution with \code{df} degrees of freedom,

R/mvTqmc.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
#' @inheritParams mvrandt
1515
#' @return a list with components
1616
#' \itemize{
17-
#' \item{\code{prob}: }{estimated value of probability Pr\eqn{(l<X<u)}}
18-
#' \item{\code{relErr}: }{estimated relative error of estimator}
19-
#' \item{\code{upbnd}: }{theoretical upper bound on true Pr\eqn{(l<X<u)} }
17+
#' \item \code{prob}: estimated value of probability Pr\eqn{(l<X<u)}
18+
#' \item \code{relErr}: estimated relative error of estimator
19+
#' \item \code{upbnd}: theoretical upper bound on true Pr\eqn{(l<X<u)}
2020
#'}
2121
#' @note If you want to estimate Pr\eqn{(l<Y<u)},
2222
#' where \eqn{Y} follows a Student distribution with \code{df} degrees of freedom,

R/mvrandn.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@
1111
#' @param mu location parameter
1212
#' @details
1313
#' \itemize{
14-
#' \item{Bivariate normal:}{
14+
#' \item Bivariate normal:
1515
#' Suppose we wish to simulate a bivariate \eqn{X} from \eqn{N(\mu,\Sigma)}, conditional on
1616
#' \eqn{X_1-X_2<-6}. We can recast this as the problem of simulation
1717
#' of \eqn{Y} from \eqn{N(0,A\Sigma A^\top)} (for an appropriate matrix \eqn{A})
1818
#' conditional on \eqn{l-A\mu < Y < u-A\mu} and then setting \eqn{X=\mu+A^{-1}Y}.
19-
#' See the example code below.}
20-
#' \item{Exact posterior simulation for Probit regression:}{Consider the
19+
#' See the example code below.
20+
#' \item Exact posterior simulation for Probit regression: Consider the
2121
#' Bayesian Probit Regression model applied to the \code{\link{lupus}} dataset.
2222
#' Let the prior for the regression coefficients \eqn{\beta} be \eqn{N(0,\nu^2 I)}. Then, to simulate from the Bayesian
2323
#' posterior exactly, we first simulate
2424
#' \eqn{Z} from \eqn{N(0,\Sigma)}, where \eqn{\Sigma=I+\nu^2 X X^\top,}
2525
#' conditional on \eqn{Z\ge 0}. Then, we simulate the posterior regression coefficients, \eqn{\beta}, of the Probit regression
2626
#' by drawing \eqn{(\beta|Z)} from \eqn{N(C X^\top Z,C)}, where \eqn{C^{-1}=I/\nu^2+X^\top X}.
27-
#' See the example code below.}
27+
#' See the example code below.
2828
#' }
2929
#' @return a \eqn{d} by \eqn{n} matrix storing the random vectors, \eqn{X}, drawn from \eqn{N(0,\Sigma)}, conditional on \eqn{l<X<u};
3030
#' @note The algorithm may not work or be very inefficient if \eqn{\Sigma} is close to being rank deficient.

R/tmvnorm.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ NULL
7575
#' @export
7676
#' @keywords internal
7777
dtmvnorm <- function(x, mu, sigma, lb, ub, log = FALSE, type = c("mc", "qmc"), B = 1e4, check = TRUE, ...){
78-
if (any(missing(x), missing(mu), missing(sigma))) {
78+
if (isTRUE(any(missing(x), missing(mu), missing(sigma)))) {
7979
stop("Arguments missing in function call to `dtmvnorm`")
8080
}
8181
sigma <- as.matrix(sigma)
@@ -168,15 +168,15 @@ ptmvnorm <- function(q, mu, sigma, lb, ub, log = FALSE, type = c("mc", "qmc"), B
168168
if(missing(ub)){
169169
ub <- rep(Inf, d)
170170
}
171-
stopifnot(all(lb < ub))
171+
stopifnot(isTRUE(all(lb < ub)))
172172
prob <- rep(0, nrow(q))
173173
kst <- switch(type,
174174
mc = mvNcdf(l = lb - mu, u = ub - mu, Sig = sigma, n = B)$prob,
175175
qmc = mvNqmc(l = lb - mu, u = ub - mu, Sig = sigma, n = B)$prob)
176176
for(i in 1:nrow(q)){
177-
if(all(q[i,] >= ub)){
177+
if(isTRUE(all(q[i,] >= ub))){
178178
prob[i] <- ifelse(log, 0, 1)
179-
} else if(any(q[i,] <= lb)){
179+
} else if(isTRUE(any(q[i,] <= lb))){
180180
prob[i] <- ifelse(log, -Inf, 0)
181181
} else{
182182
pb <- switch(type,
@@ -224,7 +224,7 @@ rtmvnorm <- function(n, mu, sigma, lb, ub, check = TRUE, ...){
224224
ub <- rep(Inf, d)
225225
}
226226
stopifnot(length(lb) == length(ub), length(lb) == d, lb <= ub)
227-
if(!any((ub - lb) < 1e-10)){
227+
if(isTRUE(!any((ub - lb) < 1e-10))){
228228
if(n == 1){
229229
as.vector(mvrandn(l = lb, u = ub, Sig = sigma, n = n, mu = mu))
230230
} else{

0 commit comments

Comments
 (0)