default.penalty {rags2ridges}R Documentation

Construct commonly used penalty matrices

Description

Function that constructs default or commonly use penalty matrices according to a (factorial) study design. The constructed penalty matrix can be used directly in optPenalty.fused.auto or serve as basis for modification.

Usage

default.penalty(
  G,
  df,
  type = c("Complete", "CartesianEqual", "CartesianUnequal", "TensorProd")
)

Arguments

G

A numeric giving the number of classes. Can also be a list of length G such as the usual argument Slist from other rags2ridges functions. Can be omitted if df is given.

df

A data.frame with G rows and factors in the columns. Note, the columns has to be of type factor. Can be omitted when G is given and type == "Complete". The factors can be ordered.

type

A character giving the type of fused penalty graph to construct. Should be 'Complete' (default), 'CartesianEqual', or 'CartesianUnequal' or 'TensorProd' or an unique abbreviation hereof. See details.

Details

The type gives a number of common choices for the penalty matrix:

Value

Returns a G by G character matrix which specify the class of penalty graphs to be used. The output is suitable as input for the penalty matrix used in optPenalty.fused.auto.

Author(s)

Anders E. Bilgrau, Carel F.W. Peeters <carel.peeters@wur.nl>, Wessel N. van Wieringen

References

Bilgrau, A.E., Peeters, C.F.W., Eriksen, P.S., Boegsted, M., and van Wieringen, W.N. (2020). Targeted Fused Ridge Estimation of Inverse Covariance Matrices from Multiple High-Dimensional Data Classes. Journal of Machine Learning Research, 21(26): 1-52.

See Also

ridgeP.fused, optPenalty.fused, default.target

Examples

  # Handling one-way designs
  default.penalty(2)
  default.penalty(4)
  Slist <- vector("list", 6)
  default.penalty(Slist)   # The function uses only the length of the list
  df0 <- expand.grid(Factor = c("lvl1", "lvl2"))
  default.penalty(df0)

  # A more elaborate example
  df1 <- expand.grid(DS = c("DS1", "DS2", "DS3"), ER = c("ER+", "ER-"))

  # Usage (various interface demonstrations)
  default.penalty(6, df1, type = "Complete")
  default.penalty(6, type = "CartesianEqual")  # GIVES WARNING
  default.penalty(6, df1, type = "CartesianEqual")
  default.penalty(Slist, df1, type = "CartesianEqual")
  default.penalty(6, df1, type = "CartesianUnequal")
  default.penalty(df1)

  # A 2 by 2 by 2 design
  df2 <- expand.grid(A = c("A1", "A2"), B = c("B1", "B2"), C = c("C1", "C3"))
  default.penalty(df2)
  default.penalty(df2, type = "CartesianEqual")
  default.penalty(df2, type = "CartesianUnequal")


[Package rags2ridges version 2.2.7 Index]