generate_restriction_list {multibridge} | R Documentation |
Creates Restriction List Based On User Specified Informed Hypothesis
Description
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.
Usage
generate_restriction_list(x = NULL, n = NULL, Hr, a, b = NULL, factor_levels)
Arguments
x |
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). |
n |
numeric. Vector of counts of trials. Must be the same length as |
Hr |
string or character. Encodes the user specified informed hypothesis. Use either specified |
a |
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 |
b |
numeric. Vector with beta parameters. Must be the same length as |
factor_levels |
character. Vector with category names. Must be the same length as |
Details
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.
Value
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 valueint(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 valuessmaller
orlarger
.
-
Note
The following signs can be used to encode restricted hypotheses: "<"
and ">"
for inequality constraints, "="
for equality constraints,
","
for free parameters, and "&"
for independent hypotheses. The restricted hypothesis can either be a string or a character vector.
For instance, the hypothesis c("theta1 < theta2, theta3")
means
-
theta1
is smaller than boththeta2
andtheta3
The parameters
theta2
andtheta3
both havetheta1
as lower bound, but are not influenced by each other.
The hypothesis c("theta1 < theta2 = theta3 & theta4 > theta5")
means that
Two independent hypotheses are stipulated:
"theta1 < theta2 = theta3"
and"theta4 > theta5"
The restrictions on the parameters
theta1
,theta2
, andtheta3
do not influence the restrictions on the parameterstheta4
andtheta5
.-
theta1
is smaller thantheta2
andtheta3
-
theta2
andtheta3
are assumed to be equal -
theta4
is larger thantheta5
Examples
# 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)