truncsm: Truncated Score Matching

View source: R/sm.R

truncsmR Documentation

Truncated Score Matching

Description

For truncated data within some boundary, estimate parameters that do not necessarily rely on the boundary.

Usage

truncsm(x, dV, family = mvn(), init = NULL, options = list(), ...)

Arguments

x

truncated random observation

dV

boundary where x was truncated (in points)

family

distribution family to look in, currently supports multivariate normal as "mvn"

init

initial conditions to be passed to optim

options

extra options that can be specified, see details

...

additional arguments that can be passed to optim

Details

For details of the procedure, see "Estimating Density Models with Complex Truncation Boundaries" by Song Liu et al.

The variable x takes values within a certain truncated region, where the boundary of this region is defined by dV. It is possible through score matching to estimate parameters that are not constrained to the boundary by minimising the difference in score functions of the model and the data - the gradient of the log pdf, i.e.

ψ = \nabla log p(x; θ).

If family is not supplied, then psi needs to be supplied as an element of options. psi will be function will calculates the derivatives of the log pdf, and needs to output a list containing two elements: the first derivative as f and second derivative as grad.

All arguments to options are:

psi

function outputting first and second derivatives of log pdf as f and grad, taking two inputs only: theta and x; the parameter to estimate over and the truncated observations.

g

function outputting function controlling behaviour at the boundary, outputting value and first derivative of the function as g and grad, taking two inputs only: the truncated observations, x and the boundary points dV.

See psi_mvn and g_def for examples.

Value

parameter estimates given by score matching


dannyjameswilliams/truncsm documentation built on Aug. 22, 2022, 3:44 p.m.