Description Usage Arguments Details Author(s) References See Also

View source: R/Mort1Dsmooth_optimize.R

This is an internal function of package `MortalitySmooth`

which
optimizes the smoothing parameter for penalized B-splines within the
function `Mort1Dsmooth`

.

1 2 3 4 | ```
Mort1Dsmooth_optimize(x, y, offset, wei,
psi2, B, DtD, a.init,
MON, TOL1, TOL2, RANGE, MAX.IT,
MET)
``` |

`x` |
vector for the abscissa of data. |

`y` |
vector of counts response. |

`offset` |
vector with an a priori known component (optional). |

`wei` |
an optional vector of weights to be used in the fitting process. |

`psi2` |
an overdispersion parameter used the quasi-likelihood approach. |

`B` |
B-splines basis. |

`DtD` |
inner product of the difference matrix |

`a.init` |
initial coefficients |

`MON` |
Logical switch indicating if monitoring is required. |

`TOL1` |
The tolerance level in the IWLS algorithm. |

`TOL2` |
difference between two adjacent smoothing parameters in the (pseudo) grid search, log-scale. |

`RANGE` |
range in which smoothing parameter should be searched. |

`MAX.IT` |
the maximum number of iterations |

`MET` |
the method for controlling the amount of smoothing |

The function aims to find the optimal smoothing parameter within the
given `RANGE`

in `Mort1Dsmooth`

with `method`

equal to 1 or 2 (BIC and AIC). It employs the function
`cleversearch`

from package `svcm`

in two separate
steps. First it searches using a rough grid (4 times `TOL2`

) and
the median of `RANGE`

as starting lambda. Afterwards it searches
in the restricted range around the sub-optimal smoothing parameter,
using a finer grid defined by `TOL2`

.

This procedure allows to find a precise smoothing parameter in an efficient way: we do not explore the full range of possible lambda values, moving at most one grid step up or down. Furthermore the two steps routine reduces the risk of finding sub-optimal smoothing parameter.

Carlo G Camarda

Camarda, C. G. (2012). MortalitySmooth: An R Package for Smoothing
Poisson Counts with P-Splines. *Journal of Statistical
Software*. 50, 1-24. http://www.jstatsoft.org/v50/i01/.

`Mort1Dsmooth_update`

,
`Mort1Dsmooth_estimate`

,
`Mort1Dsmooth`

.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.