derivative.expAD(knots, sdspline, last.three, all = TRUE)TRUE, matrix (g - 2) x g (there is one zero column) is returned.
If FALSE, matrix (g - 2) x 2 is returned.
The first row is always an intercept.
See details.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).$$