The NMMAPS DLmodel function for Splus

Produce a distributed lag or single pollutant NMMAPS analysis

DESCRIPTION:
       Calls glm to produce a standard NMMAPS single city analysis
       If argument M is given produces a distributed lag model

USAGE:
       DLmodel(dataframe, cause, pollutant, M=NULL,
              dfyr.Time  = 7, pdfyr.time = 0.15,
              df.Temp    = 6, df.Dew     = 3)

REQUIRED ARGUMENTS:
dataframe:  a dataframe with a canonical NMMAPS structure:

                agecat      date  dow  time  pm10tmean death  ....
                     1  20000101    1     1      12.31    14  ....
                     1  20000102    2     2      23.81    22  ....
                     ...                ...
                     2  20000101    1     1      12.31    33  ....
                     2  20000101    2     2      23.81    41  ....
                     ...                ...
                     3  20000101    1     1      12.31    44  ....
                     3  20000101    2     2      23.81    59  ....


            Note there are three age categories and the pollutant
            data (pm10tmean) repeats itself for each age x time
            combination.  The date variable is not used but the
            time variable is a numeric variable incrementing one
            unit for each day from the beginning of the data.
            Certain variables  are required for DLmodel to run
            successfully (time, agecat, dow, tmpd, dptp, rmtmpd,
            rmdptp along with an outcome variable and at least one
            pollutant variable). See the NMMAPS data section for
            examples and a complete listing of data.
cause:      an outcome variable (cause of death).
pollutant:  a pollutant variable

OPTIONAL ARGUMENTS:
M:          a p x n matrix used to compute the distributed lag.
            The pollutant variable is taken and a matrix of p lags
            is formed: the first column is lag0, the second lag1,
            the third is lag3, etc.  This matrix is then post
            multiplied by M to produce p analytic variables which
            are then modeled.

            The columns of M determine the combinations of lags in
            each analytic variable.  If M is absent then no
            distributed lag is run; instead the pollutant variable
            is added to the model as a linear term.
dfyr.Time:  degrees of freedom per year for time (used in ns in call
            to glm).  Note that DLmodel adjusts the degrees of freedom
            depending on amount of missing data.  If there are only
            four years of contiguous non-missing data available to
            model then the time variable enters the model in the term
            ns(time, 4*dfyr.Time).
pdfyr.time: proportion of dfyr.Time to use for time x age interaction
            (used in ns in call to glm).
df.Temp:    degrees of freedom for temperature (used in ns in call
            to glm).
df.Dew:     degrees of freedom for dew-point temperature (used in ns
            in call to glm).

VALUE:
       a summary.glm object.

EXAMPLES:
       chicL1Out <- DLmodel(dataframe=chic8700,cause="death",pollutant="l1pm10tmean")
       # lag 1 pm10 analysis for Chicago

       names <- c("avg012","avg01m3")
       M <- matrix(c( 1/3,  1/2 - 1/3,
                      1/3,  1/2 - 1/3,
                      1/3,      - 1/3),
            ncol=2, nrow=3, byrow=T, dimnames=list(NULL,names))
       DLmodel(dataframe=chic8700,cause="death",pollutant="o3tmean",M=M)
       # DL model with average of lag0, lag1, and lag2 ozone and average
       # of lag0, lag1 minus average of lag0, lag1 and lag2.

       M <- ns(1:20, df=5)
       DLmodel(dataframe=chic8700,cause="death",pollutant="o3tmean",M=M)
       # DL model using a constrained spline on 20 lags with 5 degrees
       # of freedom.