R: Create (in)equality constraint matrices

create_matrices {bain} | R Documentation

## Create (in)equality constraint matrices

### Description

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

### Usage

    create_matrices(varnames, hyp)

### Arguments

`varnames` | A character (vector of characters), containing names of variables used in the hypotheses. which the model parameters are extracted.
`hyp` | A character string, containing a hypothesis (see Details).

### 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.

### Value

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.

### Author(s)

Caspar van Lissa

[Package bain version 0.2.6 Index]