Introduction
This vignette contains the computations that underlie the numerical
code of vsn. If you
are a new user and looking for an introduction on how to
use vsn, please
refer to the vignette Robust calibration and variance
stabilization with vsn,
which is provided separately.
Setup and Notation
Consider the model:
where
,
for
,
and
,
,
for
are real-valued parameters,
is a function
(see below), and
are i.i.d. Normal with mean 0 and variance
.
are the data. In applications to
array
data,
indexes the features and
the arrays and/or colour channels.
Examples for
are
and
.
The former is the most obvious choice; in that case we will usually need
to require
.
The choice
assures that the factor in front of
is positive for all
,
and as it turns out, simplifies some of the computations.
In the following calculations, I will also use the notation
The probability of the data
lying in a certain volume element of
-space
(hyperrectangle with sides
)
is
where
is the expectation value for feature
and
the variance.
With
the likelihood is
For the following, I will need the derivatives
Note that for
,
we have
,
and for
,
.
Likelihood for Incremental Normalization
Here, incremental normalization means that the model
parameters
and
are already known from a fit to a previous set of
arrays,
i.,e. a set of reference arrays. See Section @ref(sec:prof) for the
profile likelihood approach that is used if
and
are not known and need to be estimated from the same data. Versions
of the vsn package
implement both of these approaches; in versions
only the profile likelihood approach was implemented, and it was
described in the initial publication (Huber et
al. 2002).
First, let us note that the likelihood @ref(eq:likelihood) is simply
a product of independent terms for different
.
We can optimize the parameters
separately for each
.
From the likelihood @ref(eq:likelihood) we get the
-th
negative log-likelihood
This is what we want to optimize as a function of
and
.
The optimizer benefits from the derivatives. The derivative with respect
to
is
and with respect to
Here, I have introduced the following shorthand notation for the
“intermediate results” terms
Variables for these intermediate values are also used in the C code
to organise the computations of the gradient.
Profile Likelihood
If
and
are not already known, we can plug in their maximum likelihood
estimates, obtained from optimizing
for
and
:
into the negative log-likelihood. The result is called the negative
profile log-likelihood
Note that this no longer decomposes into a sum of terms for each
that are independent of each other – the terms for different
are coupled through Equations @ref(eq:muhat) and @ref(eq:sigmahat). We
need the following derivatives.
So, finally
Summary
Likelihoods, from Equations @ref(eq:nll) and @ref(eq:npll):
The computations in the C code are organised into steps for computing
the terms “scale”, “residuals” and “jacobian”.
Partial derivatives with respect to
,
from Equations @ref(eq:ddanll) and @ref(eq:ddanpll):
Partial derivatives with respect to
,
from Equations @ref(eq:ddbnll) and @ref(eq:ddbnpll):
Note that the terms have many similarities – this is used in the
implementation in the C code.