Function to compute derivatives of all 'c' G-spline coefficients with respect to chosen (g - 3) coefficients such that the whole vector of g 'c' coefficients satisfies the constraints.
derivative.cc3(knots, sdspline, last.three, all = TRUE)
A matrix with \(\omega\) coefficients.
A vector of G-spline knots \(\mu\).
Standard deviation \(sigma_0\) of the basis G-spline .
Indeces of the three 'c' G-spline coefficients which are
expressed as a function of the remaining (g - 3)
'c' G-spline coefficients such that the three constraints
are satisfied.
This must be a vector of length 3 with three different numbers from
1:length(knots)
.
If TRUE
, matrix (g - 2) x g (there is one zero column) is returned.
If FALSE
, matrix (g - 2) x 3 is returned.
The first row is always an intercept.
See details.
Arnošt Komárek arnost.komarek@mff.cuni.cz
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 can express the three 'c' coefficients as a function of
the remaining \(g - 3\) 'c' coefficients in the following way.
$$c_{k} = \omega_{0,k} + \sum_{j\neq last.three}\omega_{j,k} c_j, %
\qquad k \in last.three,$$
where \(\omega\) coefficients are a function of knots and G-spline
standard deviation.
If we denote \(d\) the vector c[-last.three]
this function computes
derivatives of \(c\) w.r.t. \(d\) together
with the intercept term used to compute \(c\) from
\(d\). This is actually a matrix of \(\omega\)
coefficients. If we denote it as \(\Omega\) then
if all == TRUE
$$c = \Omega_{1,\cdot}^T + \Omega_{-1,\cdot}^T d$$
and if all == FALSE
$$c[last.three] = \Omega_{1,\cdot}^T + \Omega_{-1,\cdot}^T d.$$