View source: R/functions_create.R
createCon | R Documentation |
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.
createCon(G, shape = "positive+monotone.i+convex")
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. |
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.
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.
#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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.