[R] gam function & time trend spline
rdpeng at gmail.com
Tue Jul 3 02:43:27 CEST 2007
If you're looking only at winter days then you probably don't need to
remove seasonal trends, do you?
On 7/2/07, Kevin Sorensen <ksorensen84 at yahoo.com> wrote:
> I've been doing a simple time-series analysis looking
> at the relationship between daily pneumonia
> hospitalizations and daily temperature. To mimic some
> of the literature, I've been including a time-trend to
> try to account for normal cyclical trends in
> hospitalization. So I've been using a function that
> looks something like this:
> gam(pneucount ~ temp_f +
> day being the enumerated day in the analysis (1-365
> for a 1 year analysis).
> This seems to work well enough. What troubles me is
> when I think about doing an analysis focusing on
> winter days using more than one year of data. If I
> just delete the summer days from the dataset, the time
> trend spline is trying to anneal counts from the end
> of one winter with the beginning of another, which
> doesn't seem right to me.
> What's the route to a statistically defensible result?
> Is it as simple as using the subset option? Or would
> I need to create indicator variables for each winter
> I'm interested and work in a by statement somehow
> (with an extra term for the levels of that indicator,
> I assume)?
> Thanks in advance for helping a Epi student who's
> being exposed to all this for the first time.
> Kevin Sorensen
> Park yourself in front of a world of choices in alternative vehicles. Visit the Yahoo! Auto Green Center.
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Roger D. Peng | http://www.biostat.jhsph.edu/~rpeng/
More information about the R-help