Skip to content

Commit

Permalink
Remove dqrmvt
Browse files Browse the repository at this point in the history
Internally rmvt uses both rmvnorm and rchisq. The former is fine, since we were passing in our dqrnorm. However, the latter still uses R's RNG.

In order to use this, we need to implement dqrchisq and mvtnorm::rmvt needs an option rchisq=rchisq.
  • Loading branch information
rstub committed Aug 15, 2023
1 parent d60204f commit 90d0d55
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 18 deletions.
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Implement weighted sampling with and without replacement.
Move sampling methods to separate header file, allowing for parallel usage.
([#47](https://github.com/daqana/dqrng/pull/47) fixing [#18](https://github.com/daqana/dqrng/issues/18) and [#26](https://github.com/daqana/dqrng/issues/26))
* New methods `dqrmvnorm` and `dqrmvt` sampling from multivariate normal and t distribution.
* New methods `dqrmvnorm` sampling from multivariate normal distribution.
This uses the methods implemented in the `mvtnorm` package and uses `dqrnorm`.

# dqrng 0.3.0
Expand Down
17 changes: 0 additions & 17 deletions R/dqrmv.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,3 @@ dqrmvnorm <- function(n, ...) {
}
mvtnorm::rmvnorm(n, ..., rnorm = dqrnorm)
}

#' @export
#'
#' @rdname dqrmv
#' @examples
#' ## X ~ t_3(0, diag(2))
#' x <- dqrmvt(100, sigma = diag(2), df = 3) # t_3(0, diag(2)) sample
#' plot(x)
dqrmvt <- function(n, ...) {
if (!requireNamespace("mvtnorm", quietly = TRUE)) {
stop(
"Package \"mvtnorm\" must be installed to use this function.",
call. = FALSE
)
}
mvtnorm::rmvt(n, ..., rnorm = dqrnorm)
}

0 comments on commit 90d0d55

Please sign in to comment.