c2a: Work Function for 'smoothSurvReg'

View source: R/convertCDA.R

c2aR Documentation

Work Function for 'smoothSurvReg'

Description

Compute the 'a' G-spline coefficients from 'c' G-spline coefficients.

Usage

c2a(ccoef, which.zero = which.max(ccoef), toler = 1e-6)

Arguments

ccoef

A vector of 'c' G-spline coefficients.

which.zero

An index of the 'a' G-spline coefficient which will be zero (the reference one).

toler

All 'c' coefficients smaller in absolute value than toler are changed into toler (to avoid log(0)).

Details

'c' and 'a' G-spline coefficients are related by the expression

c_j = \frac{\exp(a_j)}{\sum_{l=1}^{g}\exp(a_l)}, j = 1,\dots, g,

where a_k = 0, k = which.zero. This function transforms the 'c' coefficients into their 'a' counterparts.

Value

A vector of same length as ccoef with 'a' G-spline coefficients.

Author(s)

Arnošt Komárek arnost.komarek@mff.cuni.cz

See Also

a2c

Examples

ccoef <- c(0.1, 0.2, 0.15, 0.3, 0.25)

### Compute 'a' counterparts
acoef <- c2a(ccoef, 1)
print(acoef)

### And back 'c', ccoef2 should be same as ccoef
ccoef2 <- a2c(acoef)
print(ccoef2)

smoothSurv documentation built on June 22, 2024, 11:11 a.m.

Related to c2a in smoothSurv...