# csdl: Defining the constrained segmented distributed lag term In modTempEff: Modelling temperature effects using time series data

## Description

Function employed within the `tempeff` formula to specify the variable with a csdl relationship. The function does not fit the model, it simply returns information exploited by `tempeff` to fit a `"modTempEff"` model.

## Usage

 ```1 2``` ```csdl(z, psi, L, ridge = NULL, ndx = round(L/3), DL = FALSE, diff.varying = FALSE) ```

## Arguments

 `z` the variable, typically the temperature, having the constrained segmented distributed lag parameterization with the response. `psi` numeric to provide the starting value for one or two breakpoints of the constrained segmented distributed lag relationship. `L` a numerical two-length vector to specify how many lags have to be considered to assess the effect of cold and heat. `ndx` apparent dimension (i.e. the rank) of the two B-spline bases for the DL curves of cold and heat. Default to `ndx=round(L/3)`. `ridge` a two-length named list of characters to specify the possible ridge penalty to be applied to DL coefficients. This list has to be named ('cold' and 'heat') and each component has to be in terms of `"l"`. Use `ridge=NULL` whether no ridge penalty has to be employed. See examples below. `DL` logical indicating if the difference penalty should be applied to the DL coefficients or to spline coefficients. Default to spline coefficients (`DL=FALSE`). `diff.varying` logical indicating if the difference penalty should be global or depending on the lag value to penalize differences mainly at larger rather than early lags.

## Details

This function has to be used within the formula in `tempeff`. It returns information to fit a constrained segmented distributed lag parameterization within the Poisson regression model via the function `tempeff`.

## Value

A list with the temperature variable and the arguments as attributes.

## Note

All the arguments of `csdl` may be passed via `...` in the call of `tempeff`. This feature may be useful when the same model has to be re-fitted (via `update`) by modifying only one argument of `csdl()`. See `tempeff`.

Vito Muggeo

## References

Eilers, P., Marx, B. D. (1996). Flexible Smoothing with B-splines and Penalties Statistical Science 11, 89–121.

Wood, S. N. (2006) Generalized Additive Models: An Introduction with R. Chapman and Hall/CRC Press.

Muggeo, V. M. R. (2008) Modeling temperature effects on mortality: multiple segmented relationships with common break points Biostatistics 9, 613–620.

`tempeff`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13``` ```## Not run: # Evaluate temperature effects up to 45 lags for cold and heat and # a single breakpoint; use 20 as starting value, a global difference # penalty on spline coefficients and no ridge penalty csdl(my.temperature,psi=20,L=c(45,45),ridge=NULL) # Evaluate temperature effects up to 45 lags for cold and 15 lag for # heat, via P-splines with a global difference penalty on DL coefficients # and an additional quadratic ridge penalty csdl(my.temperature,psi=20,L=c(45,15),DL=TRUE,ridge=list(cold="l^2", heat="l^2")) ## End(Not run) ```