lambda.MD {eiPack} | R Documentation |
Calculate shares using data from MD model
Description
Calculates the population share of row members in a particular column as a proportion of the total number of row members in the selected subset of columns.
Usage
lambda.MD(object, columns, ret.mcmc = TRUE)
Arguments
object |
an R object of class |
columns |
a character vector of column names to be included in calculating the shares |
ret.mcmc |
a logical value indicating how the samples from the posterior
should be returned. If |
Details
This function allows users to define subpopulations within the
data and calculate the proportion of individuals within each of the
columns that defines that subpopulation. For example, if the model
includes the groups Democrat, Republican, and Unaffiliated, the
argument columns = c(``Democrat", ``Republican")
will calculate
the two-party shares of Democrats and Republicans for each row.
Value
Returns either a ((R
* included columns) \times
samples) matrix as an mcmc
object or a (R \times
included columns \times
samples) array.
Author(s)
Michael Kellermann <mrkellermann@gmail.com> and Olivia Lau <olivia.lau@post.harvard.edu>