collapse {distrom} | R Documentation |
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 |
counts |
Either matrix or Matrix of multinomial counts, or a factor (matches |
mu |
Possible pre-specified fixed effects for |
bins |
The number of quantile bins into which we collapse |
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.
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.
Author(s)
Matt Taddy mataddy@gmail.com
See Also
we8there