# find.c: Work Function for 'smoothSurvReg' In smoothSurv: Survival Regression with Smoothed Error Distribution

## Description

Find mixture proportions that approximate given distribution by a G-spline mixture.

## Usage

 `1` ```find.c(knots, sdspline, dist = "dnorm") ```

## Arguments

 `knots` A vector of G-spline knots mu. `sdspline` Standard deviation sigma0 of the basis G-spline. `dist` A character string specifying the function used to compute a density of the distribution you want to approximate.

## Details

The function finds the G-spline coefficients that approximates a density given by `dist` in such sense that the value of the G-spline is exactly equal to the value of that density in `knots`.

## Value

Either the vector of G-spline 'c' coefficients or `NULL` if there are problems to find them.

## Author(s)

Arnošt Komárek arnost.komarek[AT]mff.cuni.cz

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19``` ```knots <- seq(-4, 4, 0.5) sd0 <- 0.3 ccoef <- find.c(knots, sd0, dist = "dstlogis") ### We plot the approximation together with the truth ### grid <- seq(-4, 4, 0.05) truth <- dstlogis(grid) ### Following lines compute the values of the approximation grid.big <- matrix(grid, nrow = length(grid), ncol = length(knots)) knots.big <- matrix(knots, nrow = length(grid), ncol = length(knots), byrow = TRUE) normals <- dnorm(grid.big, mean = knots.big, sd = sd0) approx <- normals %*% ccoef ### Plot it plot(grid, approx, type = "l", xlab = "y", ylab = "f(y)", bty = "n") lines(grid, truth, lty = 2) legend(-4, 0.35, c("approx", "truth"), lty = 1:2, bty = "n") ```

smoothSurv documentation built on July 8, 2020, 5:46 p.m.