collapse | R Documentation |
Collapses counts along equal levels of binned covariates.
collapse(v,counts,mu=NULL,bins=NULL)
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 |
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.
A list containing collapsed and formatted v
, counts
, and nbin
, along with mu = log(rowSums(counts))
, the plug-in fixed effect estimates for dmr.
Matt Taddy mataddy@gmail.com
we8there
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.