Description Usage Arguments Details Value Author(s) References Examples
This function tunes the markov chain monte carlo
algorithm used to fit a hierarchical model to ecological data in
which the underlying contigency tables can have any number of rows
or columns. The user supplies the data and may specify hyperprior
values. The function's primary output is a vector of multipliers,
called rhos
, used to adjust the covariance matrix of the
multivariate t_4 distribution used to propose new values
of intermediate-level parameters (denoted THETAS).
1 2 3 4 5 6 7 |
fstring |
String: model formula of contingency tables' column totals versus row totals. Must be in specified format (an R character string and NOT a true R formula). See Details and Examples. |
data |
Data frame. |
num.runs |
Positive integer: The number of runs or times (each of
|
num.iters |
Positive integer: The number of iterations in each run of the tuning algorithm. |
rho.vec |
Vector of dimension I = number of contigency
tables = number of rows in |
kappa |
Scalar: The diagonal of the covariance matrix for the (normal) hyperprior distribution for the mu parameter. |
nu |
Scalar: The degrees of freedom for the (Inverse-Wishart)
hyperprior distriution for the |
psi |
Scalar: The diagonal of the matrix parameter of the
(Inverse-Wishart) hyperprior distribution for the |
mu.vec.0 |
Vector: mean of the (normal) hyperprior distribution for the mu parameter. |
mu.vec.cu |
Vector of dimension R*(C-1), where R(C) is the number of rows(columns) in each contigency table: Optional starting values for mu parameter. |
nolocalmode |
Positive integer: How often an alternative drawing method for the contigency table internal cell counts will be used. Use of default value recommended. |
sr.probs |
Matrix of dimension I x R: Each value
represents the probability of selecting a particular
contingency table's row as the row to be calculated deterministically
in (product multinomial) proposals for Metropolis draws of the
internal cell counts. For example, if R = 3 and row 2 of position
|
sr.reps |
Matrix of dimension I x R: Each value represents the number of times the (product multinomial proposal) Metropolis algorithm will be attempted when, in drawing the internal cell counts, the proposal for the corresponding contingency table row is to be calculated deterministically. sr.reps has the same structure as sr.probs, i.e., position [3,1] of sr.reps corresponds to the third contingency table's first row. Use of default (generated internally) recommended. |
numscans |
Positive integer: How often the algorithm to draw the contingency table internal cell counts will be implemented before new values of the other parameters are drawn. Use of default value recommended. |
Diri |
Positive integer: How often a product Dirichlet proposal distribution will be used to draw the contingency table row probability vectors (the THETAS). |
dof |
Positive integer: The degrees of freedom of the multivariate t proposal distribution used in drawing the contingency table row probability vectors (the THETAS). |
debug |
Integer: Akin to |
Tune is a necessary precursor function to Analyze
, the workhorse
function in fitting the R x C
ecological inference model described in Greiner & Quinn (2009). The
details of this model are discussed in the documentation accompanying
Analyze
.
One of the stages of the Gibbs sampler used to fit the Greiner & Quinn ecological inference model involves sampling from the conditional posterior distribution of the vector of probabilities associated with each contingency table (precinct, in voting applications). There are R separate sets of probabilities (each of which must sum to one) associated with each contingency table. Each such θ_r undergoes a multidimensional logistic transformation, using the last (right-most) column as the reference category. This results in R transformed vectors of dimension (C-1); the transformed vectors, denoted omega_r's, are stacked to form a single omega vector corresponding to that contingency table. The omega vectors are assumed to follow (i.i.d.) a multivariate normal distribution.
The posterior distribution of the THETAs/OMEGAs are in non-standard
form. To sample from the posterior, the algorithm uses a
Metropolis-Hastings step with a multivariate t_4 proposal
distribution. The covariance matrix of this multivariate
t_4 must be expanded or shrunk to achieve acceptance
ratios of between .2 and .5. Tune implements num.runs
sets of
num.iters
iterations of the Gibbs sampler. At the end of each
set of iterations, Tune examines the acceptance ratios in each
precinct and adjusts a shrinkage factor (a scalar multiplied to the
covariance matrix of the t_4 proposal) upwards or downwards. When
finished, Tune returns a vector of length I
= the number of
contingency tables in data
, This vector, called rhos
,
should be fed into the Analyze
function. See Examples here
and accompanying Analze
.
A list with the following elements.
rhos |
A vector of length |
acc.t |
Matrix of dimension |
acc.Diri |
Matrix of dimension |
vld.NNs |
A list of length |
acc.NNs |
A list of length |
D. James Greiner, Paul D. Baines, \& Kevin M. Quinn
D. James Greiner \& Kevin M. Quinn. 2009. “R x C Ecological Inference: Bounds, Correlations, Flexibility, and Transparency of Assumptions.” J.R. Statist. Soc. A 172:67-81.
1 2 3 4 5 6 7 8 9 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.