Encodes the user specified informed hypothesis. It creates a separate restriction list for the full model, and all independent equality and inequality constraints. The returned list features relevant information for the transformation and sampling of the model parameters, such as information about the upper and lower bound for each parameter, and the indexes of equality constrained and free parameters.
generate_restriction_list(x = NULL, n = NULL, Hr, a, b = NULL, factor_levels)
a vector with data (for multinomial models) or a vector of counts of successes, or a two-dimensional table (or matrix) with 2 columns, giving the counts of successes and failures, respectively (for binomial models).
numeric. Vector of counts of trials. Must be the same length as x
. Ignored if x
is a matrix or a table
string or character. Encodes the user specified informed hypothesis. Use either specified factor_levels
or indices to refer to parameters. See ``Note'' section for details on how to formulate informed hypotheses
numeric. Vector with concentration parameters of Dirichlet distribution (for multinomial models) or alpha parameters for independent beta distributions (for binomial models). Default sets all parameters to 1
numeric. Vector with beta parameters. Must be the same length as x
. Default sets all beta parameters to 1
character. Vector with category names. Must be the same length as x
Restriction list containing the following elements:
$full_model
hyp
: character. Vector containing the informed hypothesis as specified by the user
parameters_full
: character. Vector containing the names for each constrained parameter
alpha_full
: numeric. Vector containing the concentration parameters
of the Dirichlet distribution (when evaluating ordered multinomial parameters) or alpha parameters of the
beta distribution (when evaluating ordered binomial parameters)
beta_full
: numeric. Vector containing the values of beta parameters of the beta distribution
(when evaluating ordered binomial parameters)
counts_full
: numeric. Vector containing data values (when evaluating multinomial parameters), or number
of successes (when evaluating ordered binomial parameters)
total_full
: numeric. Vector containing the number of observations (when evaluating ordered binomial
parameters, that is, number of successes and failures)
$equality_constraints
hyp
: list. Contains all independent equality constrained hypotheses
parameters_equality
: character. Vector containing the names for each equality constrained parameter.
equality_hypotheses
: list. Contains the indexes of each equality constrained parameter. Note that these indices are based on the vector of all factor levels
alpha_equalities
: list. Contains the concentration parameters for equality constrained hypotheses (when evaluating multinomial parameters) or alpha parameters of the
beta distribution (when evaluating ordered binomial parameters).
beta_equalities
: list. Contains the values of beta parameters of the beta distribution (when evaluating ordered binomial parameters)
counts_equalities
: list. Contains data values (when evaluating multinomial parameters), or number of successes
(when evaluating ordered binomial parameters) of each equality constrained parameter
total_equalitiesl
: list. Contains the number of observations of each equality constrained parameter (when evaluating ordered binomial
parameters, that is, number of successes and failures)
$inequality_constraints
hyp
: list. Contains all independent inequality constrained hypotheses
parameters_inequality
: list. Contains the names for each inequality constrained parameter
inequality_hypotheses
: list. Contains the indices of each inequality constrained parameter
alpha_inequalities
: list. Contains for inequality constrained hypotheses the concentration parameters
of the Dirichlet distribution (when evaluating ordered multinomial parameters) or alpha parameters of the beta distribution (when
evaluating ordered binomial parameters).
beta_inequalities
: list. Contains for inequality constrained hypotheses the values of beta parameters of
the beta distribution (when evaluating ordered binomial parameters).
counts_inequalities
: list. Contains for inequality constrained parameter data values (when evaluating
multinomial parameters), or number of successes (when evaluating ordered binomial parameters).
total_inequalities
: list. Contains for each inequality constrained parameter the number of observations
(when evaluating ordered binomial parameters, that is, number of successes and failures).
boundaries
: list that lists for each inequality constrained parameter the index of parameters that
serve as its upper and lower bounds. Note that these indices refer to the collapsed categories (i.e., categories after conditioning
for equality constraints). If a lower or upper bound is missing, for instance because the current parameter is set to be the
smallest or the largest, the bounds take the value int(0)
.
nr_mult_equal
: list. Contains multiplicative elements of collapsed categories
nr_mult_free
: list. Contains multiplicative elements of free parameters
mult_equal
: list. Contains for each lower and upper bound of each inequality constrained parameter
necessary multiplicative elements to recreate the implied order restriction, even for collapsed parameter values. If
there is no upper or lower bound, the multiplicative element will be 0.
nineq_per_hyp
: numeric. Vector containing the total number of inequality constrained parameters
for each independent inequality constrained hypotheses.
direction
: character. Vector containing the direction for each independent inequality constrained
hypothesis. Takes the values smaller
or larger
.
The restriction list can be created for both binomial and multinomial models. If multinomial models are specified,
the arguments b
and n
should be left empty and x
should not be a table or matrix.
# NOT RUN {
# Restriction list for ordered multinomial
x <- c(1, 4, 1, 10)
a <- c(1, 1, 1, 1)
factor_levels <- c('mult1', 'mult2', 'mult3', 'mult4')
Hr <- c('mult2 > mult1 , mult3 = mult4')
restrictions <- generate_restriction_list(x=x, Hr=Hr, a=a,
factor_levels=factor_levels)
# }
Run the code above in your browser using DataLab