diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml
index ccce1ed..688ad90 100644
--- a/.github/workflows/R-CMD-check.yaml
+++ b/.github/workflows/R-CMD-check.yaml
@@ -1,39 +1,60 @@
-# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
-# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
+# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
+# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
- branches:
- - main
- - master
+ branches: [main, master]
pull_request:
- branches:
- - main
- - master
-name: R-CMD-check
+name: R-CMD-check.yaml
+
+permissions: read-all
jobs:
R-CMD-check:
- runs-on: macOS-latest
+ runs-on: ${{ matrix.config.os }}
+
+ name: ${{ matrix.config.os }} (${{ matrix.config.r }})
+
+ strategy:
+ fail-fast: false
+ matrix:
+ config:
+ - {os: macos-latest, r: 'release'}
+ - {os: windows-latest, r: 'release'}
+ - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
+ - {os: ubuntu-latest, r: 'release'}
+ - {os: ubuntu-latest, r: 'oldrel-1'}
+
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
+ R_KEEP_PKG_SOURCE: yes
+
steps:
- - uses: actions/checkout@v2
- - uses: r-lib/actions/setup-tinytex@v2
+ - uses: actions/checkout@v6
+ - uses: r-lib/actions/setup-pandoc@v2
+
- uses: r-lib/actions/setup-r@v2
- - name: Install dependencies
+ with:
+ r-version: ${{ matrix.config.r }}
+ http-user-agent: ${{ matrix.config.http-user-agent }}
+
+ - uses: r-lib/actions/setup-tinytex@v2
+
+ - name: Install additional LaTeX packages
run: |
- install.packages(c("remotes", "rcmdcheck", "tinytex",
- "ggplot2", "gtools", "mvtnorm",
- "testthat", "knitr", "rmarkdown",
- "tidyr", "dplyr"))
- tinytex::tlmgr_install(pkgs = c("ae", "thumbpdf",
- "multirow", "listings",
- "caption", "subcaption",
- "tcolorbox", "pgf",
- "environ", "babel-english",
- "grfext", "hyperref"))
- shell: Rscript {0}
- - name: Check
- run: rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "error")
+ install.packages("tinytex")
+ tinytex::tlmgr_install(c(
+ "thumbpdf", "multirow", "listings", "caption", "subcaption",
+ "tcolorbox", "pgf", "environ", "babel-english", "grfext", "hyperref"
+ ))
shell: Rscript {0}
+
+ - uses: r-lib/actions/setup-r-dependencies@v2
+ with:
+ extra-packages: any::rcmdcheck
+ needs: check
+
+ - uses: r-lib/actions/check-r-package@v2
+ with:
+ upload-snapshots: true
+ build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml
new file mode 100644
index 0000000..5e820d3
--- /dev/null
+++ b/.github/workflows/test-coverage.yaml
@@ -0,0 +1,60 @@
+# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
+# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
+on:
+ push:
+ branches: [main, master]
+ pull_request:
+
+name: test-coverage.yaml
+
+permissions: read-all
+
+jobs:
+ test-coverage:
+ runs-on: ubuntu-latest
+ env:
+ GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
+
+ steps:
+ - uses: actions/checkout@v6
+
+ - uses: r-lib/actions/setup-r@v2
+
+ - uses: r-lib/actions/setup-r-dependencies@v2
+ with:
+ extra-packages: any::covr, any::xml2
+ needs: coverage
+
+ - name: Test coverage
+ run: |
+ cov <- covr::package_coverage(
+ quiet = FALSE,
+ clean = FALSE,
+ install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
+ )
+ print(cov)
+ covr::to_cobertura(cov)
+ shell: Rscript {0}
+
+ - uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7
+ with:
+ # Fail if error if not on PR, or if on PR and token is given
+ fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
+ files: ./cobertura.xml
+ plugins: noop
+ disable_search: true
+ token: ${{ secrets.CODECOV_TOKEN }}
+
+ - name: Show testthat output
+ if: always()
+ run: |
+ ## --------------------------------------------------------------------
+ find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
+ shell: bash
+
+ - name: Upload test results
+ if: failure()
+ uses: actions/upload-artifact@v7
+ with:
+ name: coverage-test-failures
+ path: ${{ runner.temp }}/package
diff --git a/.gitignore b/.gitignore
index 29120ad..1d5bb0f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,4 +5,5 @@ inst/doc
.Rhistory
clean_bib.sh
tests/testthat/Rplots.pdf
+.DS_Store
diff --git a/DESCRIPTION b/DESCRIPTION
index 303b985..ef306a1 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,7 +1,7 @@
Package: dirichletprocess
Type: Package
Title: Build Dirichlet Process Objects for Bayesian Modelling
-Version: 0.4.2
+Version: 0.4.2.9000
Authors@R: c(
person("Gordon", "J. Ross", email="gordon@gordonjross.co.uk", role=c("aut")),
person("Dean", "Markwick", email="dean.markwick@talk21.com", role=c("aut", "cre")),
@@ -36,4 +36,4 @@ Imports: gtools,
mvtnorm
URL: https://github.com/dm13450/dirichletprocess, https://dm13450.github.io/dirichletprocess/
BugReports: https://github.com/dm13450/dirichletprocess/issues
-RoxygenNote: 7.2.3
+Config/roxygen2/version: 8.0.0
diff --git a/NAMESPACE b/NAMESPACE
index 221c0a3..af52ea6 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -123,6 +123,7 @@ export(plot_dirichletprocess_multivariate)
export(plot_dirichletprocess_univariate)
export(true_cluster_labels)
export(weighted_function_generator)
+importFrom(ggplot2,.data)
importFrom(stats,dbeta)
importFrom(stats,dbinom)
importFrom(stats,dexp)
diff --git a/NEWS.md b/NEWS.md
index 83ea935..85492fb 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,4 +1,10 @@
-# dirichletprocess 0.4.0.9000
+# dirichletprocess 0.4.2.9000
+
+* Updated GitHub Actions
+* Fixed ggplot deprecation
+* Added some missing tests
+
+# dirichletprocess 0.4.2
* Added PriorFunction and PriorClusters to draw from the base measure.
* Fixed a bug in the likelihood calculation (#21) by Filippo Fiocchi.
diff --git a/R/diagnostic_plots.R b/R/diagnostic_plots.R
index 97b64bd..f21b817 100644
--- a/R/diagnostic_plots.R
+++ b/R/diagnostic_plots.R
@@ -36,16 +36,15 @@ DiagnosticPlots <- function(dpobj, gg = FALSE) {
}
-
-
#' @export
-#' @describeIn DiagnosticPlots Trace plot of alpha.
+#' @describeIn DiagnosticPlots Trace plot of alpha.
+#' @importFrom ggplot2 .data
AlphaTraceplot <- function(dpobj, gg = TRUE) {
if (gg) {
p <- ggplot2::ggplot(data.frame(Alpha = dpobj$alphaChain,
Index = seq_along(dpobj$alphaChain)),
- ggplot2::aes_string("Index", "Alpha")) +
+ ggplot2::aes(x=.data$Index, y=.data$Alpha)) +
ggplot2::geom_line() +
ggplot2::ggtitle("Traceplot of alpha")
return(p)
@@ -58,6 +57,7 @@ AlphaTraceplot <- function(dpobj, gg = TRUE) {
#' @export
#' @describeIn DiagnosticPlots Plot of the prior and posterior of alpha.
+#' @importFrom ggplot2 .data
AlphaPriorPosteriorPlot <- function(dpobj, prior_color = "#2c7fb8", post_color = "#d95f02", gg = TRUE) {
dap <- dpobj$alphaPriorParameters
@@ -69,14 +69,17 @@ AlphaPriorPosteriorPlot <- function(dpobj, prior_color = "#2c7fb8", post_color =
p <- ggplot2::ggplot() +
ggplot2::geom_histogram(data = data.frame(Alpha = dpobj$alphaChain),
- mapping = ggplot2::aes_string("Alpha",
- "..density..",
- colour = "'Posterior'", fill = "'Posterior'"),
+ mapping = ggplot2::aes(x=.data$Alpha,
+ ggplot2::after_stat(.data$density),
+ colour = "'Posterior'",
+ fill = "'Posterior'"),
bins = min(its / 10, 100)) +
ggplot2::stat_function(fun = prior_fun,
- mapping = ggplot2::aes_string(colour = "'Prior'")) +
+ mapping = ggplot2::aes(colour = "'Prior'")) +
ggplot2::ggtitle("Prior and posterior of alpha") +
- ggplot2::scale_colour_manual(labels = c("Posterior", "Prior"), values = c(prior_color, post_color), aesthetics = c("colour", "fill"), name = " ")
+ ggplot2::scale_colour_manual(labels = c("Posterior", "Prior"),
+ values = c(prior_color, post_color),
+ aesthetics = c("colour", "fill"), name = " ")
return(p)
} else {
graphics::hist(dpobj$alphaChain, freq = FALSE, breaks = min(its / 10, 100),
@@ -90,6 +93,7 @@ AlphaPriorPosteriorPlot <- function(dpobj, prior_color = "#2c7fb8", post_color =
#' @export
#' @describeIn DiagnosticPlots Trace plot of the number of clusters.
+#' @importFrom ggplot2 .data
ClusterTraceplot <- function(dpobj, gg = TRUE) {
n_clust <- vapply(dpobj$labelsChain, function(x) length(unique(x)), numeric(1))
@@ -97,7 +101,7 @@ ClusterTraceplot <- function(dpobj, gg = TRUE) {
if (gg) {
p <- ggplot2::ggplot(data.frame(nclust = n_clust,
Index = seq_along(n_clust)),
- ggplot2::aes_string("Index", "nclust")) +
+ ggplot2::aes(x=.data$Index, y=.data$nclust)) +
ggplot2::geom_line() +
ggplot2::ylab("Number of clusters") +
ggplot2::ggtitle("Traceplot of the number of clusters")
@@ -117,7 +121,7 @@ LikelihoodTraceplot <- function(dpobj, gg = TRUE) {
if (gg) {
p <- ggplot2::ggplot(data.frame(Lik = dpobj$likelihoodChain,
Index = seq_along(dpobj$likelihoodChain)),
- ggplot2::aes_string("Index", "Lik")) +
+ ggplot2::aes(x=.data$Index, y=.data$Lik)) +
ggplot2::geom_line() +
ggplot2::ylab("Log-likelihood") +
ggplot2::ggtitle("Traceplot of the log-likelihood")
diff --git a/R/dirichletprocess-package.R b/R/dirichletprocess-package.R
new file mode 100644
index 0000000..a65cf64
--- /dev/null
+++ b/R/dirichletprocess-package.R
@@ -0,0 +1,6 @@
+#' @keywords internal
+"_PACKAGE"
+
+## usethis namespace: start
+## usethis namespace: end
+NULL
diff --git a/R/plot_dirichletprocess.R b/R/plot_dirichletprocess.R
index 9a15b66..2db5634 100644
--- a/R/plot_dirichletprocess.R
+++ b/R/plot_dirichletprocess.R
@@ -32,6 +32,7 @@ plot_dirichletprocess.mvnormal <- function(x, ...) {
#' @export
#' @rdname plot.dirichletprocess
+#' @importFrom ggplot2 .data
plot_dirichletprocess_univariate <- function(x,
likelihood = FALSE,
single = TRUE,
@@ -43,15 +44,17 @@ plot_dirichletprocess_univariate <- function(x,
quant_pts = 100,
xlim = NA) {
- graph <- ggplot2::ggplot(data.frame(dt = x$data), ggplot2::aes_(x = ~dt)) +
+ graph <- ggplot2::ggplot(data.frame(dt = x$data), ggplot2::aes(x = .data$dt)) +
ggplot2::theme(axis.title = ggplot2::element_blank())
if (data_method == "density") {
graph <- graph + ggplot2::geom_density(fill = data_fill,
- bw = ifelse(is.null(data_bw), "nrd0", data_bw))
+ bw = ifelse(is.null(data_bw),
+ "nrd0",
+ data_bw))
} else if (data_method == "hist" | data_method == "histogram") {
- graph <- graph + ggplot2::geom_histogram(ggplot2::aes_(x = ~dt,
- y = ~..density..),
+ graph <- graph + ggplot2::geom_histogram(ggplot2::aes(x = .data$dt,
+ ggplot2::after_stat(.data$density)),
fill = data_fill,
binwidth = data_bw)
} else if (data_method != "none") {
@@ -76,9 +79,9 @@ plot_dirichletprocess_univariate <- function(x,
quantile, probs = c(ci_size/2, 0.5, 1 - ci_size/2),
na.rm = TRUE)
- graph <- graph + ggplot2::geom_line(data=data.frame(x=x_grid, y=posteriorCI[1,]), ggplot2::aes_(x=~x,y=~y, colour="Posterior"), linetype=2)
- graph <- graph + ggplot2::geom_line(data=data.frame(x=x_grid, y=posteriorCI[2,]), ggplot2::aes_(x=~x,y=~y, colour="Posterior"))
- graph <- graph + ggplot2::geom_line(data=data.frame(x=x_grid, y=posteriorCI[3,]), ggplot2::aes_(x=~x,y=~y, colour="Posterior"), linetype=2)
+ graph <- graph + ggplot2::geom_line(data=data.frame(x=x_grid, y=posteriorCI[1,]), ggplot2::aes(x=.data$x,y=.data$y, colour="Posterior"), linetype=2)
+ graph <- graph + ggplot2::geom_line(data=data.frame(x=x_grid, y=posteriorCI[2,]), ggplot2::aes(x=.data$x,y=.data$y, colour="Posterior"))
+ graph <- graph + ggplot2::geom_line(data=data.frame(x=x_grid, y=posteriorCI[3,]), ggplot2::aes(x=.data$x,y=.data$y, colour="Posterior"), linetype=2)
if (likelihood) {
graph <- graph + ggplot2::stat_function(fun = function(z) LikelihoodFunction(x)(z),
@@ -93,11 +96,17 @@ plot_dirichletprocess_univariate <- function(x,
#' @export
#' @rdname plot.dirichletprocess
+#' @importFrom ggplot2 .data
plot_dirichletprocess_multivariate <- function(x) {
- plotFrame <- data.frame(x1=x$data[,1], x2=x$data[,2], Cluster=as.factor(x$clusterLabel))
+ plotFrame <- data.frame(x1=x$data[,1],
+ x2=x$data[,2],
+ Cluster=as.factor(x$clusterLabel))
- graph <- ggplot2::ggplot(plotFrame, ggplot2::aes_(x=~x1, y=~x2, colour=~Cluster)) +
+ graph <- ggplot2::ggplot(plotFrame,
+ ggplot2::aes(x=.data$x1,
+ y=.data$x2,
+ colour=.data$Cluster)) +
ggplot2::geom_point()
return(graph)
}
diff --git a/README.Rmd b/README.Rmd
index bd14981..20a2d78 100644
--- a/README.Rmd
+++ b/README.Rmd
@@ -17,10 +17,12 @@ knitr::opts_chunk$set(
# dirichletprocess
-[](https://github.com/dm13450/dirichletprocess/actions)
+
+[](https://github.com/dm13450/dirichletprocess/actions/workflows/R-CMD-check.yaml)
[](https://ci.appveyor.com/project/dm13450/dirichletprocess)
[](https://app.codecov.io/gh/dm13450/dirichletprocess)
-
+[](https://app.codecov.io/gh/dm13450/dirichletprocess)
+
The dirichletprocess package provides tools for you to build custom Dirichlet process mixture models. You can use the pre-built Normal/Weibull/Beta distributions or create your own following the instructions in the vignette. In as little as four lines of code you can be modelling your data nonparametrically.
diff --git a/docs/404.html b/docs/404.html
index a2eda44..20aba5f 100644
--- a/docs/404.html
+++ b/docs/404.html
@@ -1,62 +1,33 @@
-
-
-
-
+
+
+
+
-
Page not found (404) • dirichletprocess
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
+
+
+
-
-
+
+
+
-
-
-
-
-
-
+
+
+
diff --git a/docs/authors.html b/docs/authors.html
index 7daad34..152e3b8 100644
--- a/docs/authors.html
+++ b/docs/authors.html
@@ -1,62 +1,18 @@
-
-
-
-
-
-
-
-Authors • dirichletprocess
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Authors and Citation • dirichletprocess
-
+
-
-
-
-
-
+
-
-
-
+
-
@@ -135,22 +101,20 @@
Authors
-
+
+
-
-
-
+
diff --git a/docs/index.html b/docs/index.html
index f0b025a..871b215 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -6,29 +6,27 @@
Build Dirichlet Process Objects for Bayesian Modelling • dirichletprocess
-
+
-
+
+
+
+
-
+
-
-
-
+
+
+
The dirichletprocess package provides tools for you to build custom Dirichlet process mixture models. You can use the pre-built Normal/Weibull/Beta distributions or create your own following the instructions in the vignette. In as little as four lines of code you can be modelling your data nonparametrically.
-
-
- Installation
+
+
Installation
+
You can install the stable release of dirichletprocess from CRAN:
-
+
You can also install the development build of dirichletprocess from github with:
-
-# install.packages("devtools")
-devtools ::install_github ("dm13450/dirichletprocess" )
-
+
+# install.packages("devtools")
+devtools :: install_github ( "dm13450/dirichletprocess" )
For a full guide to the package and its capabilities please consult the vignette:
-
-
-
-
- Examples
-
-
- Density Estimation
+
+
+
+
Examples
+
+
+
Density Estimation
+
Dirichlet processes can be used for nonparametric density estimation.
-
-faithfulTransformed <- faithful $ waiting - mean (faithful $ waiting )
-faithfulTransformed <- faithfulTransformed / sd (faithful $ waiting )
-dp <- DirichletProcessGaussian (faithfulTransformed )
-dp <- Fit (dp , 100 , progressBar = FALSE )
-plot (dp )
-
+
+faithfulTransformed <- faithful $ waiting - mean ( faithful $ waiting )
+faithfulTransformed <- faithfulTransformed / sd ( faithful $ waiting )
+dp <- DirichletProcessGaussian ( faithfulTransformed )
+dp <- Fit ( dp , 100 , progressBar = FALSE )
+plot ( dp )
-
-
- Clustering
+
+
Clustering
+
Dirichlet processes can also be used to cluster data based on their common distribution parameters.
-
+
For more detailed explanations and examples see the vignette.
-
-
- Tutorials
+
+
Tutorials
+
I’ve written a number of tutorials:
and some case studies:
@@ -154,55 +142,60 @@
-
Developed by Gordon J. Ross, Dean Markwick.
+
+
Developed by Gordon J. Ross, Dean Markwick.
-
+
+
+
diff --git a/docs/news/index.html b/docs/news/index.html
index 2026dfb..44149ff 100644
--- a/docs/news/index.html
+++ b/docs/news/index.html
@@ -1,62 +1,18 @@
-
-
-
-
-
-
-
-
Changelog • dirichletprocess
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Changelog • dirichletprocess
+
-
-
-
-
-
+
-
-
-
-Added PriorFunction and PriorClusters to draw from the base measure.
-
-
-
-
-
-Hierarchical Normal Models added by Giovanni Sighinolfi
+
+
+
Updated GitHub Actions
+Fixed ggplot deprecation
+Added some missing tests
+
+
+
+
Added PriorFunction and PriorClusters to draw from the base measure.
+Fixed a bug in the likelihood calculation (#21 ) by Filippo Fiocchi.
+Added hierarchical print statement method.
+
+
+
+
Hierarchical Normal Models added by Giovanni Sighinolfi
Added Giovanni Sighinolfi as a contributor.
Added params chain to Hidden Markov Models
Updated the vignette for hierarchical normal models.
-
-
-
-
-
-Fixed matrix class checking for R 4.0.0
+
+
+
+
Fixed matrix class checking for R 4.0.0
Corrected typos in vignette
Added a parameter for the number of initial clusters in DirichletProcessMvnormal.
Various refactoring.
-
-
-
-
-
-Added Hidden Markov models.
+
+
+
+
Added Hidden Markov models.
Fixed bug in PosteriorClusters and PosteriorFunction.
Added in new Beta mixture model for avoiding boundary.
Fixed a bug in ChangeObservations when using more than one dimension.
Added in Burn, Print and Diagnostic Plots.
-
-
-
-
-
-Added a likelihood variable for the dirichletprocess class that is calculate with each fit iteration.
+
+
+
+
Added a likelihood variable for the dirichletprocess class that is calculate with each fit iteration.
Added option to change how many Metropolis-Hasting steps are used in each iteration.
Added a likelihood calculation with each iteration.
Added and refactored some tests.
Updated vignette.
Additional options to univariate plotting.
Added Kees Mulder as a contributor.
-
-
-
-
-
-Added AppVeyor, Travis-CI and codecov.io badges.
+
+
+
+
Added AppVeyor, Travis-CI and codecov.io badges.
Added penalised log-likelihood step for posterior cluster parameter inference.
Added exponential mixture model DirichletProcessExponential.
Updated plot. Multivariate Gaussian models can now be plotted.
Various bug fixes.
Updated description.
-
-
-
+
+
+
First public release.
Added a NEWS.md file to track changes to the package.
-
-
+
+
Contents
+
-
+
+
-
-
-
+
diff --git a/docs/pkgdown.css b/docs/pkgdown.css
index 1273238..80ea5b8 100644
--- a/docs/pkgdown.css
+++ b/docs/pkgdown.css
@@ -56,8 +56,10 @@ img.icon {
float: right;
}
-img {
+/* Ensure in-page images don't run outside their container */
+.contents img {
max-width: 100%;
+ height: auto;
}
/* Fix bug in bootstrap (only seen in firefox) */
@@ -78,11 +80,10 @@ dd {
/* Section anchors ---------------------------------*/
a.anchor {
- margin-left: -30px;
- display:inline-block;
- width: 30px;
- height: 30px;
- visibility: hidden;
+ display: none;
+ margin-left: 5px;
+ width: 20px;
+ height: 20px;
background-image: url(./link.svg);
background-repeat: no-repeat;
@@ -90,17 +91,15 @@ a.anchor {
background-position: center center;
}
-.hasAnchor:hover a.anchor {
- visibility: visible;
-}
-
-@media (max-width: 767px) {
- .hasAnchor:hover a.anchor {
- visibility: hidden;
- }
+h1:hover .anchor,
+h2:hover .anchor,
+h3:hover .anchor,
+h4:hover .anchor,
+h5:hover .anchor,
+h6:hover .anchor {
+ display: inline-block;
}
-
/* Fixes for fixed navbar --------------------------*/
.contents h1, .contents h2, .contents h3, .contents h4 {
@@ -264,31 +263,26 @@ table {
/* Syntax highlighting ---------------------------------------------------- */
-pre {
- word-wrap: normal;
- word-break: normal;
- border: 1px solid #eee;
-}
-
-pre, code {
+pre, code, pre code {
background-color: #f8f8f8;
color: #333;
}
+pre, pre code {
+ white-space: pre-wrap;
+ word-break: break-all;
+ overflow-wrap: break-word;
+}
-pre code {
- overflow: auto;
- word-wrap: normal;
- white-space: pre;
+pre {
+ border: 1px solid #eee;
}
-pre .img {
+pre .img, pre .r-plt {
margin: 5px 0;
}
-pre .img img {
+pre .img img, pre .r-plt img {
background-color: #fff;
- display: block;
- height: auto;
}
code a, pre a {
@@ -305,9 +299,8 @@ a.sourceLine:hover {
.kw {color: #264D66;} /* keyword */
.co {color: #888888;} /* comment */
-.message { color: black; font-weight: bolder;}
-.error { color: orange; font-weight: bolder;}
-.warning { color: #6A0366; font-weight: bolder;}
+.error {font-weight: bolder;}
+.warning {font-weight: bolder;}
/* Clipboard --------------------------*/
@@ -365,3 +358,27 @@ mark {
content: "";
}
}
+
+/* Section anchors ---------------------------------
+ Added in pandoc 2.11: https://github.com/jgm/pandoc-templates/commit/9904bf71
+*/
+
+div.csl-bib-body { }
+div.csl-entry {
+ clear: both;
+}
+.hanging-indent div.csl-entry {
+ margin-left:2em;
+ text-indent:-2em;
+}
+div.csl-left-margin {
+ min-width:2em;
+ float:left;
+}
+div.csl-right-inline {
+ margin-left:2em;
+ padding-left:1em;
+}
+div.csl-indent {
+ margin-left: 2em;
+}
diff --git a/docs/pkgdown.js b/docs/pkgdown.js
index 7e7048f..6f0eee4 100644
--- a/docs/pkgdown.js
+++ b/docs/pkgdown.js
@@ -80,7 +80,7 @@
$(document).ready(function() {
var copyButton = "
";
- $(".examples, div.sourceCode").addClass("hasCopyButton");
+ $("div.sourceCode").addClass("hasCopyButton");
// Insert copy buttons:
$(copyButton).prependTo(".hasCopyButton");
@@ -91,7 +91,7 @@
// Initialize clipboard:
var clipboardBtnCopies = new ClipboardJS('[data-clipboard-copy]', {
text: function(trigger) {
- return trigger.parentNode.textContent;
+ return trigger.parentNode.textContent.replace(/\n#>[^\n]*/g, "");
}
});
diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml
index dba4b4c..73f839b 100644
--- a/docs/pkgdown.yml
+++ b/docs/pkgdown.yml
@@ -1,6 +1,5 @@
-pandoc: 2.3.1
-pkgdown: 1.6.1
+pandoc: 3.8.3
+pkgdown: 2.2.0
pkgdown_sha: ~
articles: {}
-last_built: 2020-09-25T06:58Z
-
+last_built: 2026-08-07T04:37Z
diff --git a/docs/reference/BetaMixture2Create.html b/docs/reference/BetaMixture2Create.html
index 1f32d8f..af1f0a9 100644
--- a/docs/reference/BetaMixture2Create.html
+++ b/docs/reference/BetaMixture2Create.html
@@ -1,66 +1,18 @@
-
-
-
-
-
-
-
-
Create a Beta mixture with zeros at the boundaries. — BetaMixture2Create • dirichletprocess
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Create a Beta mixture with zeros at the boundaries. — BetaMixture2Create • dirichletprocess
+
-
-
-
-
-
+
-
Create a Beta mixture with zeros at the boundaries.
-
-
BetaMixture2Create (priorParameters = 2 , mhStepSize = c (1 , 1 ),
- maxT = 1 )
-
-
Arguments
-
-
-
- priorParameters
- The prior parameters for the base measure.
-
-
- mhStepSize
- The Metropolis Hastings step size. A numeric vector of length 2.
-
-
- maxT
- The upper bound of the Beta distribution. Defaults to 1 for the standard Beta distribution.
-
-
-
-
Value
+
+
BetaMixture2Create ( priorParameters = 2 , mhStepSize = c ( 1 , 1 ) , maxT = 1 )
+
+
+
+
Arguments
+
+
+
priorParameters
+The prior parameters for the base measure.
+
+mhStepSize
+The Metropolis Hastings step size. A numeric vector of length 2.
+
+
+maxT
+The upper bound of the Beta distribution. Defaults to 1 for the standard Beta distribution.
+
+
+
+
Value
A mixing distribution object.
-
+
+
Contents
+
-
+
+
-
-
-
+
diff --git a/docs/reference/BetaMixtureCreate.html b/docs/reference/BetaMixtureCreate.html
index 238755c..954ef1f 100644
--- a/docs/reference/BetaMixtureCreate.html
+++ b/docs/reference/BetaMixtureCreate.html
@@ -1,66 +1,18 @@
-
-
-
-
-
-
-
-
Create a Beta mixing distribution. — BetaMixtureCreate • dirichletprocess
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Create a Beta mixing distribution. — BetaMixtureCreate • dirichletprocess
-
+
-
-
-
-
+
-
BetaMixtureCreate (priorParameters = c (2 , 8 ), mhStepSize = c (1 , 1 ),
- maxT = 1 , hyperPriorParameters = c (1 , 0.125 ))
-
-
Arguments
-
-
-
- priorParameters
- The prior parameters for the base measure.
-
-
- mhStepSize
- The Metropolis Hastings step size. A numeric vector of length 2.
-
-
- maxT
- The upper bound of the Beta distribution. Defaults to 1 for the standard Beta distribution.
-
-
- hyperPriorParameters
- The parameters for the hyper prior.
-
-
-
-
Value
+
+
BetaMixtureCreate (
+ priorParameters = c ( 2 , 8 ) ,
+ mhStepSize = c ( 1 , 1 ) ,
+ maxT = 1 ,
+ hyperPriorParameters = c ( 1 , 0.125 )
+)
+
+
+
+
Arguments
+
+
+
priorParameters
+The prior parameters for the base measure.
+
+mhStepSize
+The Metropolis Hastings step size. A numeric vector of length 2.
+
+
+maxT
+The upper bound of the Beta distribution. Defaults to 1 for the standard Beta distribution.
+
+
+hyperPriorParameters
+The parameters for the hyper prior.
+
+
+
+
Value
A mixing distribution object.
-
+
+
Contents
+
-
+
+
-
-
-
+
diff --git a/docs/reference/Burn-1.png b/docs/reference/Burn-1.png
index 174dc8a..3830202 100644
Binary files a/docs/reference/Burn-1.png and b/docs/reference/Burn-1.png differ
diff --git a/docs/reference/Burn-2.png b/docs/reference/Burn-2.png
index 62d1553..780fe0b 100644
Binary files a/docs/reference/Burn-2.png and b/docs/reference/Burn-2.png differ
diff --git a/docs/reference/Burn.html b/docs/reference/Burn.html
index 8fa5ea9..0f56636 100644
--- a/docs/reference/Burn.html
+++ b/docs/reference/Burn.html
@@ -1,66 +1,18 @@
-
-
-
-
-
-
-
-
Add burn-in to a dirichletprocess object — Burn • dirichletprocess
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Add burn-in to a dirichletprocess object — Burn • dirichletprocess
+
-
-
-
-
-
+
-
Add burn-in to a dirichletprocess object
-
-
Burn (dpobj , niter )
-
-
Arguments
-
-
-
- dpobj
- A dirichletprocess object.
-
-
- niter
- Number of iterations to burn.
-
-
-
-
Value
+
+
+
+
Arguments
+
+
+
dpobj
+A dirichletprocess object.
+
+niter
+Number of iterations to burn.
+
+
+
+
Value
A dirichletprocess object where all chain objects have the first
niter iterations are removed.
-
-
-
Examples
-
+
+
+
+
Contents
+
-
+
+
-
-
-
+
diff --git a/docs/reference/ChangeObservations.html b/docs/reference/ChangeObservations.html
index 1a15f83..01554fc 100644
--- a/docs/reference/ChangeObservations.html
+++ b/docs/reference/ChangeObservations.html
@@ -1,66 +1,18 @@
-
-
-
-
-
-
-
-
Change the observations of fitted Dirichlet Process. — ChangeObservations • dirichletprocess
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Change the observations of fitted Dirichlet Process. — ChangeObservations • dirichletprocess
+
-
-
-
-
-
+
-
Using a fitted Dirichlet process object include new data. The new data will be assigned to the best fitting cluster for each point.
-
-
ChangeObservations (dpobj , newData )
-
-
Arguments
-
-
-
- dpobj
- The Dirichlet process object.
-
-
- newData
- New data to be included
-
-
-
-
Value
+
+
ChangeObservations ( dpobj , newData )
+
-
Changed Dirichlet process object
-
+
+
Arguments
+
+
+
dpobj
+The Dirichlet process object.
- Examples
-
+newData
+New data to be included
+
+
+
+
Value
+
Changed Dirichlet process object
+
+
+
+
Contents
+
-
+
+
-
-
-
+
diff --git a/docs/reference/ClusterComponentUpdate.html b/docs/reference/ClusterComponentUpdate.html
index 3719e51..62b9deb 100644
--- a/docs/reference/ClusterComponentUpdate.html
+++ b/docs/reference/ClusterComponentUpdate.html
@@ -1,66 +1,18 @@
-
-
-
-
-
-
-
-
Update the component of the Dirichlet process — ClusterComponentUpdate • dirichletprocess
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Update the component of the Dirichlet process — ClusterComponentUpdate • dirichletprocess
-
+
-
-
-
-
+
-
Update the cluster assignment for each data point.
-
-
ClusterComponentUpdate (dpObj )
-
-# S3 method for conjugate
-ClusterComponentUpdate (dpObj )
-
-# S3 method for hierarchical
-ClusterComponentUpdate (dpObj )
-
-
Arguments
-
-
-
- dpObj
- Dirichlet Process object
-
-
-
-
Value
+
+
ClusterComponentUpdate ( dpObj )
+
+# S3 method for class 'conjugate'
+ClusterComponentUpdate ( dpObj )
+
+# S3 method for class 'hierarchical'
+ClusterComponentUpdate ( dpObj )
+
-
Dirichlet process object with update components.
-
+
+
Arguments
-
Examples
-
+
dpObj
+Dirichlet Process object
+
+
+
+
Value
+
Dirichlet process object with update components.
+
+
+
+
Contents
+
-
+
+
-
-
-
+
diff --git a/docs/reference/ClusterLabelPredict.html b/docs/reference/ClusterLabelPredict.html
index d74979d..9d366f4 100644
--- a/docs/reference/ClusterLabelPredict.html
+++ b/docs/reference/ClusterLabelPredict.html
@@ -1,66 +1,18 @@
-
-
-
-
-
-
-
-
Predict the cluster labels of some new data. — ClusterLabelPredict • dirichletprocess
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Predict the cluster labels of some new data. — ClusterLabelPredict • dirichletprocess
+
-
-
-
-
-
+
-
Given a fitted Dirichlet process object and some new data use this function to predict what clusters the new data belong to and associated cluster parameters.
-
-
ClusterLabelPredict (dpobj , newData )
-
-
Arguments
-
-
-
- dpobj
- Fitted Dirichlet Process
-
-
- newData
- New data to have cluster labels predicted.
-
-
-
-
Value
+
+
ClusterLabelPredict ( dpobj , newData )
+
-
A list of the predicted cluster labels of some new unseen data.
-
+
+
Arguments
+
+
+
dpobj
+Fitted Dirichlet Process
- Examples
-
+newData
+New data to have cluster labels predicted.
+
+
+
+
Value
+
A list of the predicted cluster labels of some new unseen data.
+
+
+
+
Contents
+
-
+
+
-
-
-
+
diff --git a/docs/reference/ClusterParameterUpdate.html b/docs/reference/ClusterParameterUpdate.html
index d599447..2907378 100644
--- a/docs/reference/ClusterParameterUpdate.html
+++ b/docs/reference/ClusterParameterUpdate.html
@@ -1,67 +1,19 @@
-
-
-
-
-
-
-
-
Update the cluster parameters of the Dirichlet process. — ClusterParameterUpdate • dirichletprocess
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Update the cluster parameters of the Dirichlet process. — ClusterParameterUpdate • dirichletprocess
-
+
-
-
-
-
+
-
Update the parameters of each individual cluster using all the data assigned to the particular cluster.
A sample is taken from the posterior distribution using a direct sample if the mixing distribution is conjugate or the Metropolis Hastings algorithm for non-conjugate mixtures.
-
-
ClusterParameterUpdate (dpObj )
-
-
Arguments
-
-
-
- dpObj
- Dirichlet process object
-
-
-
-
Value
+
+
ClusterParameterUpdate ( dpObj )
+
-
Dirichlet process object with update cluster parameters
-
+
+
Arguments
-
Examples
-
+
dpObj
+Dirichlet process object
+
+
+
+
Value
+
Dirichlet process object with update cluster parameters
+
+
+
+
Contents
+
-
+
+
-
-
-
+
diff --git a/docs/reference/DiagnosticPlots-1.png b/docs/reference/DiagnosticPlots-1.png
index ed2e96e..8bc602c 100644
Binary files a/docs/reference/DiagnosticPlots-1.png and b/docs/reference/DiagnosticPlots-1.png differ
diff --git a/docs/reference/DiagnosticPlots.html b/docs/reference/DiagnosticPlots.html
index e0a42f5..b814e93 100644
--- a/docs/reference/DiagnosticPlots.html
+++ b/docs/reference/DiagnosticPlots.html
@@ -1,69 +1,21 @@
-
-
-
-
-
-
-
-
Diagnostic plots for dirichletprocess objects — DiagnosticPlots • dirichletprocess
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Diagnostic plots for dirichletprocess objects — DiagnosticPlots • dirichletprocess
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
+
-
Plot several diagnostic plots for dirichletprocess objects. Because the
dimension of the dirichletprocess mixture is constantly changing, it is not
simple to create meaningful plots of the sampled parameters. Therefore, the
plots focus on the likelihood, alpha, and the number of clusters.
-
-
DiagnosticPlots (dpobj , gg = FALSE )
+
+
DiagnosticPlots ( dpobj , gg = FALSE )
+
+AlphaTraceplot ( dpobj , gg = TRUE )
+
+AlphaPriorPosteriorPlot (
+ dpobj ,
+ prior_color = "#2c7fb8" ,
+ post_color = "#d95f02" ,
+ gg = TRUE
+)
+
+ClusterTraceplot ( dpobj , gg = TRUE )
+
+LikelihoodTraceplot ( dpobj , gg = TRUE )
+
+
+
+
Arguments
-
AlphaTraceplot (
dpobj , gg =
TRUE )
-
AlphaPriorPosteriorPlot (
dpobj , prior_color =
"#2c7fb8" ,
- post_color =
"#d95f02" , gg =
TRUE )
+
dpobj
+A dirichletprocess object that was fit.
-ClusterTraceplot (dpobj , gg = TRUE )
-LikelihoodTraceplot (dpobj , gg = TRUE )
-
- Arguments
-
-
-
- dpobj
- A dirichletprocess object that was fit.
-
-
- gg
- Logical; whether to create a ggplot or base R plot (if gg =
+gg
+Logical; whether to create a ggplot or base R plot (if gg =
FALSE). For DiagnosticPlots, this means that the plots will be
-given one-by-one, while base plots can be arranged in a grid.
-
-
- prior_color
- For AlphaPriorPosteriorPlot, the color of the prior
-function.
-
-
- post_color
- For AlphaPriorPosteriorPlot, the color of the
-posterior histogram.
-
-
-
- Value
+given one-by-one, while base plots can be arranged in a grid.
+
+
+prior_color
+For AlphaPriorPosteriorPlot, the color of the prior
+function.
+
+post_color
+For AlphaPriorPosteriorPlot, the color of the
+posterior histogram.
+
+
+
+
Value
If gg = TRUE, a ggplot2 object. Otherwise, nothing is returned
and a base plot is plotted.
-
-
Functions
-
-
-
-AlphaTraceplot: Trace plot of alpha.
-AlphaPriorPosteriorPlot: Plot of the prior and posterior of alpha.
-ClusterTraceplot: Trace plot of the number of clusters.
-LikelihoodTraceplot: Trace plot of the likelihood of the data for
+
+
+
Functions
+
+
AlphaTraceplot(): Trace plot of alpha.
+AlphaPriorPosteriorPlot(): Plot of the prior and posterior of alpha.
+ClusterTraceplot(): Trace plot of the number of clusters.
+LikelihoodTraceplot(): Trace plot of the likelihood of the data for
each iteration.
-
-
-
-
Examples
-
-
+
+
+
+
Contents
+
-
+
+
-
-
-
+