tally.data {RelativeRisk}R Documentation

Tallies data

Description

Tallies data into strata according to the values of environmental variables.

Usage

        tally.data(sName,fName,indexName,data,sigDigits=2)

Arguments

sName The quoted name of the data column containing either success counts, or values in (0,1) to be pooled: 1 is success.
fName If present, the quoted name of the data column containing the failure counts matching the success counts in sName.
indexName The quoted name of the index variable for the counts in sName: 1 is success.
data A data frame, whose columns contain the values of environmental variables defining the strata.
sigDigits The number of significant digits used to compare numerical environmental variable levels.

Details

This function may be used before performing a GLM analysis for binary data to prepare a matrix of success, failure counts and associated environmental variable values. tally.data() will be called by est.rr() if doTally in est.rr() is set to TRUE. For large data sets, tally.data() may take a while, so it is best to run it separately from est.rr() if possible.

The strata are created by pooling together all data rows with equivalent sets of environmental variables. Numerical values are compared after rounding to sigDigits. The first set of environmental variables in a stratum is taken as typical and then output as the stratum's description in the output matrix.

Value

A list with elements (log, Y, X). log will contain a comment. Y will contain a matrix, with columns (success,failure) containing counts for each stratum. The matrix X will contain the values of the environmental variables for the stratum.

Note

All columns in data will be used to define the strata. Redundant columns should be eliminated before calling this function. if tally.data() is called from est.rr(), redundant columns not appearing in the formula will be discarded automatically.

Author(s)

Bob Wheeler bwheelerg@gmail.com

Please cite this program as follows:

Wheeler, R.E. (2009). tally.data RelativeRisk. The R project for statistical computing http://www.r-project.org/

Examples


        data(TitanicMat)
        ad<-tally.data("count",indexName="survived",data=TitanicMat)
        ad$Y
        ad$X

[Package RelativeRisk version 1.1-1 Index]