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 mu. |
sdspline |
Standard deviation sigma0 of the basis G-spline. |
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
c[1] + ... c[g] = 1,
c[1]mu[1] + ... c[g]mu[g] = 0,
c[1]mu[1]^2 + ... c[g]mu[g]^2 = 1 - sigma0^2
imposed on the G-spline we use the following parametrization:
c[j] = exp(a[j])/[exp(a[1]) + ... + exp(a[g])], j = 1, ..., 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[omega[0,k] + sum[j != last.three]omega[j,k]exp(a[j])], 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) = t(Omega_[1,]) + t(Omega[-1,])exp(d)
and if all == FALSE
exp(a[last.three[2:3]]) = t(Omega_[1,]) + t(Omega[-1,])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.