Generate sets of constraint matrices (constr), right hand side elements, and numbers of equality constraints (nec) with a predefined structure
constrSet(n, set = c("sequence", "seqcontrol", "lplateau", "uplateau", "downturn", "williams"), direction = c("increase", "decrease"), base = 1)
n | a (possibly named) vector of sample sizes for each group. |
---|---|
set | character string defining the type of constraints; one of "sequence", "seqcontrol", "lplateau", "uplateau", or "downturn" |
direction | direction of the inequality constraints, either "increase" or "decrease" |
base | column of the constraint matrix representing a control group |
a list with slots constr, rhs, and nec for each constraint definition
n <- c(10,20,30,40) constrSet(n, set="sequence")#> $`1<2` #> $`1<2`$constr #> 1 2 3 4 #> [1,] -1 1 0 0 #> #> $`1<2`$rhs #> [1] 0 #> #> $`1<2`$nec #> [1] FALSE #> #> #> $`1<2<3` #> $`1<2<3`$constr #> 1 2 3 4 #> [1,] -1 1 0 0 #> [2,] 0 -1 1 0 #> #> $`1<2<3`$rhs #> [1] 0 0 #> #> $`1<2<3`$nec #> [1] FALSE FALSE #> #> #> $`1<2<3<4` #> $`1<2<3<4`$constr #> 1 2 3 4 #> [1,] -1 1 0 0 #> [2,] 0 -1 1 0 #> [3,] 0 0 -1 1 #> #> $`1<2<3<4`$rhs #> [1] 0 0 0 #> #> $`1<2<3<4`$nec #> [1] FALSE FALSE FALSE #> #> #> $unconstrained #> $unconstrained$constr #> 1 2 3 4 #> [1,] 0 0 0 0 #> #> $unconstrained$rhs #> [1] 0 #> #> $unconstrained$nec #> [1] FALSE #> #>constrSet(n, set="seqcontrol")#> $`1<2` #> $`1<2`$constr #> 1 2 3 4 #> [1,] -1 1 0 0 #> #> $`1<2`$rhs #> [1] 0 #> #> $`1<2`$nec #> [1] FALSE #> #> #> $`1<2|1<3` #> $`1<2|1<3`$constr #> 1 2 3 4 #> [1,] -1 1 0 0 #> [2,] -1 0 1 0 #> #> $`1<2|1<3`$rhs #> [1] 0 0 #> #> $`1<2|1<3`$nec #> [1] FALSE FALSE #> #> #> $`1<2|1<3|1<4` #> $`1<2|1<3|1<4`$constr #> 1 2 3 4 #> [1,] -1 1 0 0 #> [2,] -1 0 1 0 #> [3,] -1 0 0 1 #> #> $`1<2|1<3|1<4`$rhs #> [1] 0 0 0 #> #> $`1<2|1<3|1<4`$nec #> [1] FALSE FALSE FALSE #> #> #> $unconstrained #> $unconstrained$constr #> [,1] [,2] [,3] [,4] #> [1,] 0 0 0 0 #> #> $unconstrained$rhs #> [1] 0 #> #> $unconstrained$nec #> [1] FALSE #> #>constrSet(n, set="lplateau")#> $`1=2=3=4` #> $`1=2=3=4`$constr #> 1 2 3 4 #> [1,] -1 1 0 0 #> [2,] 0 -1 1 0 #> [3,] 0 0 -1 1 #> #> $`1=2=3=4`$rhs #> [1] 0 0 0 #> #> $`1=2=3=4`$nec #> [1] TRUE TRUE TRUE #> #> #> $`1=2=3<4` #> $`1=2=3<4`$constr #> 1 2 3 4 #> [1,] -1 1 0 0 #> [2,] 0 -1 1 0 #> [3,] 0 0 -1 1 #> #> $`1=2=3<4`$rhs #> [1] 0 0 0 #> #> $`1=2=3<4`$nec #> [1] TRUE TRUE FALSE #> #> #> $`1=2<3<4` #> $`1=2<3<4`$constr #> 1 2 3 4 #> [1,] -1 1 0 0 #> [2,] 0 -1 1 0 #> [3,] 0 0 -1 1 #> #> $`1=2<3<4`$rhs #> [1] 0 0 0 #> #> $`1=2<3<4`$nec #> [1] TRUE FALSE FALSE #> #> #> $`1<2<3<4` #> $`1<2<3<4`$constr #> 1 2 3 4 #> [1,] -1 1 0 0 #> [2,] 0 -1 1 0 #> [3,] 0 0 -1 1 #> #> $`1<2<3<4`$rhs #> [1] 0 0 0 #> #> $`1<2<3<4`$nec #> [1] FALSE FALSE FALSE #> #> #> $unconstrained #> $unconstrained$constr #> [,1] [,2] [,3] [,4] #> [1,] 0 0 0 0 #> #> $unconstrained$rhs #> [1] 0 #> #> $unconstrained$nec #> [1] FALSE #> #>constrSet(n, set="uplateau")#> $`1<2<3<4` #> $`1<2<3<4`$constr #> 1 2 3 4 #> [1,] -1 1 0 0 #> [2,] 0 -1 1 0 #> [3,] 0 0 -1 1 #> #> $`1<2<3<4`$rhs #> [1] 0 0 0 #> #> $`1<2<3<4`$nec #> [1] FALSE FALSE FALSE #> #> #> $`1<2<3=4` #> $`1<2<3=4`$constr #> 1 2 3 4 #> [1,] -1 1 0 0 #> [2,] 0 -1 1 0 #> [3,] 0 0 -1 1 #> #> $`1<2<3=4`$rhs #> [1] 0 0 0 #> #> $`1<2<3=4`$nec #> [1] FALSE FALSE TRUE #> #> #> $`1<2=3=4` #> $`1<2=3=4`$constr #> 1 2 3 4 #> [1,] -1 1 0 0 #> [2,] 0 -1 1 0 #> [3,] 0 0 -1 1 #> #> $`1<2=3=4`$rhs #> [1] 0 0 0 #> #> $`1<2=3=4`$nec #> [1] FALSE TRUE TRUE #> #> #> $`1=2=3=4` #> $`1=2=3=4`$constr #> 1 2 3 4 #> [1,] -1 1 0 0 #> [2,] 0 -1 1 0 #> [3,] 0 0 -1 1 #> #> $`1=2=3=4`$rhs #> [1] 0 0 0 #> #> $`1=2=3=4`$nec #> [1] TRUE TRUE TRUE #> #> #> $unconstrained #> $unconstrained$constr #> [,1] [,2] [,3] [,4] #> [1,] 0 0 0 0 #> #> $unconstrained$rhs #> [1] 0 #> #> $unconstrained$nec #> [1] FALSE #> #>constrSet(n, set="downturn")#> $`1<2<3<4` #> $`1<2<3<4`$constr #> 1 2 3 4 #> [1,] -1 1 0 0 #> [2,] 0 -1 1 0 #> [3,] 0 0 -1 1 #> #> $`1<2<3<4`$rhs #> [1] 0 0 0 #> #> $`1<2<3<4`$nec #> [1] FALSE FALSE FALSE #> #> #> $`1<2<3>4` #> $`1<2<3>4`$constr #> 1 2 3 4 #> [1,] -1 1 0 0 #> [2,] 0 -1 1 0 #> [3,] 0 0 1 -1 #> #> $`1<2<3>4`$rhs #> [1] 0 0 0 #> #> $`1<2<3>4`$nec #> [1] FALSE FALSE FALSE #> #> #> $`1<2>3>4` #> $`1<2>3>4`$constr #> 1 2 3 4 #> [1,] -1 1 0 0 #> [2,] 0 1 -1 0 #> [3,] 0 0 1 -1 #> #> $`1<2>3>4`$rhs #> [1] 0 0 0 #> #> $`1<2>3>4`$nec #> [1] FALSE FALSE FALSE #> #> #> $unconstrained #> $unconstrained$constr #> [,1] [,2] [,3] [,4] #> [1,] 0 0 0 0 #> #> $unconstrained$rhs #> [1] 0 #> #> $unconstrained$nec #> [1] FALSE #> #>constrSet(n, set="williams")#> $`1 < 2` #> $`1 < 2`$constr #> 1 2 3 4 #> [1,] -1 1 0 0 #> #> $`1 < 2`$rhs #> [1] 0 #> #> $`1 < 2`$nec #> [1] FALSE #> #> #> $`1 < ave(2,3)` #> $`1 < ave(2,3)`$constr #> 1 2 3 4 #> [1,] -1 1.0 0.0 0 #> [2,] -1 0.4 0.6 0 #> #> $`1 < ave(2,3)`$rhs #> [1] 0 0 #> #> $`1 < ave(2,3)`$nec #> [1] FALSE FALSE #> #> #> $`1 < ave(2,3,4)` #> $`1 < ave(2,3,4)`$constr #> 1 2 3 4 #> [1,] -1 1.0000000 0.0000000 0.0000000 #> [2,] -1 0.4000000 0.6000000 0.0000000 #> [3,] -1 0.2222222 0.3333333 0.4444444 #> #> $`1 < ave(2,3,4)`$rhs #> [1] 0 0 0 #> #> $`1 < ave(2,3,4)`$nec #> [1] FALSE FALSE FALSE #> #> #> $unconstrained #> $unconstrained$constr #> 1 2 3 4 #> [1,] 0 0 0 0 #> #> $unconstrained$rhs #> [1] 0 #> #> $unconstrained$nec #> [1] FALSE #> #>