Fits the constrained segmented distributed lag log-linear regression model to daily time series data of mortality and temperature and additional confounding factors.

1 2 3 |

`formula` |
the model formula such as ‘response ~ parametric terms + csdl(temperature) + seas(day)’, see details. |

`data` |
the dataset where the variables are stored. |

`subset` |
an optional vector specifying a subset of observations to be used. |

`na.action` |
a function to indicate how to handle NA observations. |

`fcontrol` |
a list with components returned by |

`etastart` |
possible starting values on the scale of the linear predictor. |

`drop.L` |
integer, specifying whether the first ' |

`...` |
additional arguments to be passed to |

The function fits a log-linear regression model to assess the effects of temperature on mortality using a ‘constrained segmented distributed lag parameterization’ (csdl). It is assumed that the data are daily time series of mortality (or perhaps morbidity) and temperature. The left hand side of the formula includes the response (daily counts), and the right hand side may include one or more of the following

linear confounders (such as influenza epidemics or day-of-week);

nonparametric long term trend, via the function

`seas`

;the csdl effect of temperature via the function

`csdl`

.

All the arguments of `csdl()`

may be passed via `...`

directly in the call of `tempeff`

. This may
facilitate the user when different models have to be fitted by changing only some of (and not all) the arguments
of `csdl()`

. See the example below.

The function returns an object of class `"modTempEff"`

. It is the list returned by `gam.fit`

of
package `mgcv`

with the additional components

`psi ` |
The estimated breakpoint with corresponding standard error (bayesian and frequentist). |

`betaCold` |
The estimated DL coefficients for the cold effect. |

`SE.c` |
The frequentist standard errors of the cold DL estimates. |

`SE.c.bayes` |
The bayesian standard errors of the cold DL estimates. |

`ToTcold` |
Estimate and frequentist standard error of the total (net) effect of cold. |

`ToTcold.bayes` |
Estimate and bayesian standard error of the total (net) effect of cold. |

`edf.cold` |
The df associated at each spline coefficient of the DL curve of cold. |

`rank.cold` |
The apparent dimension of the B-spline basis of the DL for cold. |

`betaHeat` |
The estimated DL coefficients for the heat effect. |

`SE.h` |
The frequentist standard errors of the heat DL estimates. |

`SE.h.bayes` |
The bayesian standard errors of the heat DL estimates. |

`ToTheat` |
Estimate and frequentist standard error of the total (net) effect of heat. |

`ToTheat.bayes` |
Estimate and bayesian standard error of the total (net) effect of heat. |

`edf.heat` |
The df associated at each spline coefficient of the DL curve of heat. |

`rank.heat` |
The apparent dimension of the B-spline basis of the DL for heat. |

`rank.seas` |
When |

`edf.seas` |
When |

`fit.seas` |
When |

When a `csdl`

term is included in the formula, the first `max(L)`

observations are discarded
before model fitting. When a csdl term is *not* included, the argument `drop.L`

may be used to discard
the first `drop.L`

observations anyway. Fitting models with the same number of observations may be useful
to compare them via likelihood-based criteria (via `anova.modTempEff`

, say).

`tempeff()`

returns objects of class `"modTempEff"`

, so proper methods may be employed. The returned
object has class `"modTempEff"`

even if `tempeff()`

is called without `csdl()`

in the formula,
or even if the model is fitted with fixed (not estimated) breakpoints (via

`tempeff(..,fcontrol=fit.control(it.max=0))`

).

Vito Muggeo, vito.muggeo@unipa.it

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

Muggeo, V.M.R. (2009) Analyzing Temperature Effects on Mortality Within the R
Environment: The Constrained Segmented Distributed Lag Parameterization
*Journal of Statistical Software*, **32** 12, 1–17.

`modTempEff-package`

, `plot.modTempEff`

, `summary.modTempEff`

,
`gam.fit`

in package `mgcv`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ```
## Not run:
library(modTempEff)
data(dataDeathTemp)
o1<-tempeff(dec1~day+factor(dweek)+factor(year)+factor(month)+
csdl(mtemp,L=c(60,60),psi=20),
data=dataDeathTemp, fcontrol = fit.control(display=TRUE))
#add a ridge penalty: note how you *can* specify ridge!
#you do NOT need to use csdl(..,ridge=..)
o2<-update(o1, ridge=list(cold="l^2", heat="l^2"))
#a model without temperature effects (the first drop.L obs are dropped)
o3<-tempeff(dec1~day+factor(dweek)+factor(year)+factor(month),
data=dataset,drop.L=60)
#see ?anova.modTempEff for model comparisons
## End(Not run)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

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.