Collapse CRC data through micro post-stratification

Share:

Description

Rounding continuous covariates creates "micro-post-strata" and therefore tends to reduce the number of distinct covariate vectors. After rounding, the data is collapsed so that there is exactly one row for each distinct covariate vector, and a column called mct (for multinomial cell count) is appended with that contains the number of records corresponding to each row.

Usage

1
micro.post.stratify(dat, round.vars = NULL, rounding.scale = NULL)

Arguments

dat

The data in a matrix form

round.vars

A vector of names of variables to be rounded for the purpose of collapsing the data.

rounding.scale

A vector of scalars that determines how much each corresponding variable in round.vars is to be rounded. For example, the first variable round.vars[1] will be divided by rounding.scale[1], then rounded to the nearest whole number, and then multiplied by rounding.scale[1]. The net effect is to round to the nearest multiple of rounding.scale[1].

Details

Continuous variables will be divided by rounding.scale, then rounded to the nearest whole number, and then multiplied by rounding.scale. The net effect is to round to the nearest multiple of rounding.scale

Value

Another matrix, just like the input dat except that there are fewer rows, data values are rounded, and there is a new column mct, which gives the number of data points corresponding to each row.

Author(s)

Zach Kurtz

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.