Learn R Programming

distrom (version 1.0.1)

collapse: Data checking and binning

Description

Collapses counts along equal levels of binned covariates.

Usage

collapse(v,counts,mu=NULL,bins=NULL)

Arguments

v

Either matrix or Matrix of covariates (matches covars in dmr).

counts

Either matrix or Matrix of multinomial counts, or a factor (matches counts in dmr).

mu

Possible pre-specified fixed effects for dmr; otherwise they are calculated here.

bins

The number of quantile bins into which we collapse v. bins=NULL does no collapsing.

Value

A list containing collapsed and formatted v, counts, and nbin, along with mu = log(rowSums(counts)), the plug-in fixed effect estimates for dmr.

Details

For each column of v, aggregates the observations into bins defined by their average value. Both v and counts are then collapsed according to levels of the interaction across implied bin-factors, and the number of observations in each bin is recorded as n. Look at the code of the dmr function to see collapse used in practice.

See Also

we8there