derivative.expAD | R Documentation |
Function to compute derivatives of exp(a) w.r.t. exp(d) where d stands for a shorter vector of 'a' G-spline coefficients.
derivative.expAD(knots, sdspline, last.three, all = TRUE)
knots |
A vector of G-spline knots |
sdspline |
Standard deviation |
last.three |
Indeces of the three 'a' G-spline coefficients which are
expressed as a function of the remaining (g-3)
'a' G-spline coefficients such that the three constraints
are satisfied.
This must be a vector of length 3 with three different numbers from
|
all |
If |
To satisfy the three constraints
\sum_{j=1}^g c_j = 1,
\sum_{j=1}^g c_j \mu_j = 0,
\sum_{j=1}^g c_j \mu_j^2 = 1 - \sigma_0^2
imposed on the G-spline we use the following parametrization:
c_j = \frac{\exp(a_j)}{\sum_{l=1}^{g}\exp(a_l)}, j = 1,\dots, g.
The constraints can be solved such that a[last.three[1]] = 0
and
a[last.three[2:3]]
are expressed as a function of
a[-last.three]
in the following way:
a_{k} = \log\Bigl\{\omega_{0,k} + \sum_{j\neq last.three}\omega_{j,k}\exp(a_j)\Bigr\},%
\qquad k = last.three[2], last.three[3],
where \omega
coefficients are a function of knots and G-spline
standard deviation.
If we denote d
the vector a[-last.three]
this function computes
derivatives of \exp(a)
w.r.t. \exp(d)
together
with the intercept term used to compute \exp(a)
from
\exp(d)
. This is actually a matrix of \omega
coefficients. If we denote it as \Omega
then
if all == TRUE
\exp(a) = \Omega_{1,\cdot}^T + \Omega_{-1,\cdot}^T\exp(d)
and if all == FALSE
\exp(a[last.three[2:3]]) = \Omega_{1,\cdot}^T + \Omega_{-1,\cdot}^T\exp(d).
A matrix with \omega
coefficients.
WARNING: This function is primarily used inside smoothSurvReg
.
Consequently, it has very few error checks on its input arguments.
Arnošt Komárek arnost.komarek@mff.cuni.cz
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.