The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

scorematchingad

R-CMD-check

The goal of scorematchingad is to enable fast implementation of score matching estimators through the use of automatic differentiation in the CppAD library. Such implementation is best done by either contributing to this package or creating a new package that links to this package. On linux with the gcc compiler it is possible to create estimators for new models interactively using customll() (I am pondering how it is that this feature only works on linux with gcc).

See the file DESCRIPTION for a slightly longer description, and ./R/scorematchingad-package.R (equivalently help(scorematchingad, scorematchingad) from within R) for an even longer description. The built-in help for R packages is well populated.

Installation

You can install the development version of scorematchingad from GitHub with:

# install.packages("devtools")
devtools::install_github("kasselhingee/scorematchingad")

Example

Some models are already incorporated into scorematchingad. Below is an example of estimating the Polynomially-Tilted Pairwise Interaction model (Scealy and Wood, 2023) for compositional data:

library(scorematchingad)
model <- rppi_egmodel(100)
estalr <- ppi(model$sample,
              paramvec = ppi_paramvec(betap = -0.5, p = ncol(model$sample)),
              trans = "alr")

This is an example of obtaining a tape of the score matching discrepancy of a custom likelihood for compositional data, which most naturally lies on the simplex:

myll <- customll("a1type dirichlet(const veca1 &u, const veca1 &beta) {
  size_t d  = u.size();
  a1type y(0.);  // initialize summation at 0
  for(size_t i = 0; i < d; i++)
  {   y   += beta[i] * log(u[i]);
  }
  return y;
}")

tapes <- buildsmdtape("sim", "identity", "sim", 
 myll, rep(1/3, 3), rep(NA, 3), 
 bdryw="minsq", acut = 0.01)

Using scorematchingad in Other Packages [draft notes]

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.