createCon: Create a list of constraints for co-data weight estimation

View source: R/functions_create.R

createConR Documentation

Create a list of constraints for co-data weight estimation

Description

Create a list of constraints to be used by ecpc in estimating G co-data weights. Combine constraints with p-splines to estimate shape-constrained functions, e.g. positive, monotone increasing and/or convex functions.

Usage

createCon(G, shape = "positive+monotone.i+convex")

Arguments

G

Number of co-data weights that should be estimated subject to constraints.

shape

Common type of shapes, including ‘positive’, 'monotone.i' ('monotone.d') for monotonically increasing (decreasing), 'convex' ('concave'), or any combination thereof by attaching multiple with a '+' sign.

Value

A list of the form list(M.ineq = M.ineq, b.ineq = b.ineq) with the matrix M.ineq and vector b.ineq containing the inequality constraints corresponding to the given shape.

See Also

The relation between the prior variance and co-data may be estimated with a shape-constrained spline, see createZforSplines and createS for creating a spline basis and difference penalty matrix for a co-data variable. See ecpc for an example.

Examples

#create constraints for positivity
Con1 <- createCon(G=10, shape="positive") 
#create constraints for positive and monotonically increasing weights
Con2 <- createCon(G=10, shape="positive+monotone.i")  


ecpc documentation built on May 13, 2022, 5:07 p.m.