Description Usage Arguments Details Author(s) References See Also

View source: R/Mort2Dsmooth_optimize.R

This is an internal function of package `MortalitySmooth`

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

.

1 2 3 4 5 6 7 | ```
Mort2Dsmooth_optimize(x, y, Z, offset, wei,
psi2, Bx, By, nbx, nby,
RTBx, RTBy, Px, Py,
a.init,
MON, TOL1, TOL2,
RANGEx, RANGEy,
MAX.IT, MET)
``` |

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

`y` |
vector for the ordinate of data. |

`Z` |
matrix of counts response. |

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

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

`psi2` |
overdispersion parameter. |

`Bx` |
B-splines basis for the x-axis. |

`By` |
B-splines basis for the y-axis. |

`nbx` |
number of B-splines for the x-axis. |

`nby` |
number of B-splines for the y-axis. |

`RTBx` |
tensors product of B-splines basis for the x-axis. |

`RTBy` |
tensors product of B-splines basis for the y-axis. |

`Px` |
penalty factor for the x-axis. |

`Py` |
penalty factor for the y-axis. |

`a.init` |
matrix with the 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 grid search, log-scale. |

`RANGEx` |
range in which smoothing parameter for x should be searched. |

`RANGEy` |
range in which smoothing parameter for y 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 parameters within the
given `RANGEx`

and `RANGEy`

in `Mort2Dsmooth`

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 `RANGEx`

and `RANGEy`

as
starting lambdas. Afterwards it searches in the restricted areas
around the sub-optimal smoothing parameters, using a finer grid
defined by `TOL2`

.

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

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/.

`Mort2Dsmooth_update`

,
`Mort2Dsmooth_estimate`

,
`Mort2Dsmooth`

.

MortalitySmooth documentation built on May 29, 2017, 7:11 p.m.

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.