create_matrices: Create (in)equality constraint matrices

View source: R/create_matrices.R

create_matricesR Documentation

Create (in)equality constraint matrices


Parses a character string describing a set of informative hypotheses, and returns (in)equality constraint matrices


create_matrices(varnames, hyp)



A character (vector of characters), containing names of variables used in the hypotheses. which the model parameters are extracted.


A character string, containing a hypothesis (see Details).


Informative hypotheses specified as a character string by "hyp" should adhere to the following simple syntax:

  • Competing hypotheses are separated by ";". Thus, "a=b;a>b" means that H1: a=b, and H2: a>b.

  • Each individual hypothesis consists of a (series of) (in)equality constraint(s). Every single (in)equality constraint is of the form "R1*mu1 + R2*mu2+... = r", where capital Rs refer to numeric scaling constants, must refer to the names of parameters in the model, and the lower case r refers to a constant. Standard mathematical simplification rules apply; thus, "R1*mu1 = R2*mu2" is equivalent to "R1*mu1 - R2*mu2 = 0".

  • Multiple unrelated constraints within one hypothesis can be chained by "&". Thus, "a=b&c=d" means that H1: a=b AND c=d.

  • Multiple related constraints within one hypothesis can be chained by repeating the (in)equality operators "=", "<", or ">". Thus, "a<b<c" means that H1: a < b AND b < c.

  • Parameters can be grouped by placing them in a parenthesized, comma separated list. Thus, "(a,b)>c" means that H1: a > c AND b > c. Similarly, "(a,b)>(c,d)" means that H1: a > c AND b > c AND b > c AND b > d.


A pair of named matrices for every hypothesis specified in the hyp argument; one matrix named ERr, specifying equality constraints, and one matrix named IRr, specifying inequality constraints.


Caspar van Lissa

bain documentation built on Sept. 27, 2023, 5:06 p.m.