Learn R Programming

smoothSurv (version 2.6)

a2c: Work Function for 'smoothSurvReg'

Description

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

Usage

a2c(acoef)

Value

A vector of same length as acoef with 'c' G-spline coefficients.

Arguments

acoef

A vector of 'a' G-spline coefficients.

Author

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

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.

See Also

c2a

Examples

Run this code
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)

Run the code above in your browser using DataLab