Skip to content

Commit

Permalink
update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfidler committed Aug 29, 2024
1 parent 29d9451 commit ae8d354
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 19 deletions.
4 changes: 4 additions & 0 deletions R/lotri.R
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,10 @@ NULL
#' it is equivalent to `cov=TRUE` with the additional ability to
#' correct the matrix to be non-positive definite if needed.
#'
#' @param rcm logical; if `TRUE`, the matrix will be reordered to
#' change the matrix to a banded matrix, which is easier to express
#' in `lotri` than a full matrix.
#'
#' @inheritParams base::eval
#' @inheritParams as.lotri
#'
Expand Down
31 changes: 31 additions & 0 deletions R/lotriNearPD.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,40 @@
#' symmetry test. \emph{Beware} however that setting it \code{FALSE}
#' for an \bold{a}symmetric input \code{x}, is typically nonsense!
#'
#' @param do2eigen logical indicating if a `posdefify()` (like in the
#' package `sfsmisc`) eigen step should be applied to the result of
#' the Higham algorithm
#'
#' @seealso A first version of this (with non-optional \code{corr=TRUE})
#' has been available as `sfsmisc::nearcor()` and
#' more simple versions with a similar purpose
#' `sfsmisc::posdefify()`
#'
#' @return unlike the matrix package, this simply returns the nearest
#' positive definite matrix
#'
#' @author Jens \enc{Oehlschlägel}{Oehlschlaegel} donated a first
#' version to Matrix. Subsequent changes by the Matrix package
#' authors, later modifications to C++ by Matthew Fidler
#'
#' @details
#'
#' This implements the algorithm of Higham (2002), and then (if
#' \code{do2eigen} is true) forces positive definiteness using code from
#' `sfsmisc::posdefify()`. The algorithm of Knol and ten
#' Berge (1989) (not implemented here) is more general in that it
#' allows constraints to (1) fix some rows (and columns) of the matrix and
#' (2) force the smallest eigenvalue to have a certain value.
#'
#' Note that setting \code{corr = TRUE} just sets \code{diag(.) <- 1}
#' within the algorithm.
#'
#' Higham (2002) uses Dykstra's correction, but the version by Jens
#' \enc{Oehlschlägel}{Oehlschlaegel} did not use it (accidentally),
#' and still gave reasonable results; this simplification, now only
#' used if \code{doDykstra = FALSE},
#' was active in \code{nearPD()} up to Matrix version 0.999375-40.
#'
#' @examples
#'
#' set.seed(27)
Expand Down
6 changes: 5 additions & 1 deletion man/lotri.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 19 additions & 18 deletions man/lotriNearPD.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ae8d354

Please sign in to comment.