cppad_closed {scorematchingad} | R Documentation |
Score Matching Estimator for Quadratic-Form Score Matching Discrepancies
Description
For a tape (i.e. an ADFun
object) of a quadratic-form score matching discrepancy function, calculates the vector of parameters such that the gradient of the score matching discrepancy is zero.
Also estimates standard errors and covariance.
Many score matching estimators have an objective function that has a quadratic form (see scorematchingtheory
).
Usage
cppad_closed(
smdtape,
Y,
Yapproxcentres = NA * Y,
w = rep(1, nrow(Y)),
approxorder = 10
)
Arguments
smdtape |
A |
Y |
A matrix of multivariate observations. Each row is an observation. |
Yapproxcentres |
A matrix of Taylor approximation centres for rows of Y that require approximation. |
w |
Weights for each observation. |
approxorder |
The order of Taylor approximation to use. |
Details
When the score matching discrepancy function is of quadratic form, then the gradient of the score matching discrepancy is zero at H^{-1}b
,
where H
is the average of the Hessian of the score matching discrepancy function evaluated at each measurement and
b
is the average of the gradient offset (see quadratictape_parts()
) evaluated at each measurement.
Both the Hessian and the gradient offset are constant with respect to the model parameters for quadratic-form score matching discrepancy functions.
Standard errors use the Godambe information matrix (aka sandwich method) and are only computed when the weights are constant.
The estimate of the negative of the sensitivity matrix -G
is
the average of the Hessian of smdtape
evaluated at each observation in Y
.
The estimate of the variability matrix J
is
the sample covariance (denominator of n-1
) of the gradient of smdtape
evaluated at each of the observations in Y
for the estimated \theta
.
The estimated variance of the estimator is then as
G^{-1}JG^{-1}/n,
where n
is the number of observations.
Taylor approximation is available because boundary weight functions and transformations of the measure in Hyvärinen divergence can remove singularities in the model log-likelihood, however evaluation at these singularities may still involve computing intermediate values that are unbounded. If the singularity is ultimately removed, then Taylor approximation from a nearby location will give a very accurate evaluation at the removed singularity.
See Also
Other generic score matching tools:
Windham()
,
cppad_search()
Examples
smdtape <- buildsmdtape("sim", "sqrt", "sph", "ppi",
ytape = rep(1/3, 3),
usertheta = ppi_paramvec(p = 3),
bdryw = "minsq", acut = 0.01,
verbose = FALSE
)$smdtape
Y <- rppi_egmodel(100)
cppad_closed(smdtape, Y$sample)