[R] gam function & time trend splines
Kevin Sorensen
ksorensen84 at yahoo.com
Mon Jul 2 20:05:16 CEST 2007
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 +
s(day,bs="cr",k=(4*totalyears)+1),
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.
Sincerely,
Kevin Sorensen
____________________________________________________________________________________
Park yourself in front of a world of choices in alternative vehicles. Visit the Yahoo! Auto Green Center.
More information about the R-help
mailing list