R/rags2ridgesFused.R
default.target.fused.Rd
Generates a list of (data-driven) targets to use in fused ridge estimation.
Simply a wrapper for default.target
.
default.target.fused(Slist, ns, type = "DAIE", by, ...)
A list
of length \(K\) of numeric
covariance
matrices of the same size for \(K\) classes.
A numeric
vector of sample sizes corresponding to the
entries of Slist
.
A character
giving the choice of target to construct. See
default.target
for the available options. Default is
"DAIE"
.
A character
vector with the same length as Slist
specifying which groups should share target. For each unique entry of
by
a target is constructed. If omitted, the default is to assign a
unique target to each class. If not given as a character
coercion
into one is attempted.
Arguments passed to default.target
.
A list
of \(K\) covariance target matrices of the same size.
# Make some toy data
ns <- c(3, 4) # Two classes with sample size 3 and 4
Slist <- createS(ns, p = 3) # Generate two 3-dimensional covariance matrices
Slist
#> $class1
#> A B C
#> A 0.5350243 0.7195370 -0.5558835
#> B 0.7195370 1.5885096 -0.4801166
#> C -0.5558835 -0.4801166 0.6927923
#>
#> $class2
#> A B C
#> A 0.85764628 0.03205939 0.4239914
#> B 0.03205939 0.09458489 0.2146714
#> C 0.42399139 0.21467137 0.8111733
#>
# Different choices:
default.target.fused(Slist, ns)
#> $class1
#> A B C
#> A 1.114223 0.000000 0.000000
#> B 0.000000 1.114223 0.000000
#> C 0.000000 0.000000 1.114223
#>
#> $class2
#> A B C
#> A 14.6301 0.0000 0.0000
#> B 0.0000 14.6301 0.0000
#> C 0.0000 0.0000 14.6301
#>
default.target.fused(Slist, ns, by = seq_along(Slist)) # The same as before
#> $class1
#> A B C
#> A 1.114223 0.000000 0.000000
#> B 0.000000 1.114223 0.000000
#> C 0.000000 0.000000 1.114223
#>
#> $class2
#> A B C
#> A 14.6301 0.0000 0.0000
#> B 0.0000 14.6301 0.0000
#> C 0.0000 0.0000 14.6301
#>
default.target.fused(Slist, ns, type = "Null")
#> $class1
#> A B C
#> A 0 0 0
#> B 0 0 0
#> C 0 0 0
#>
#> $class2
#> A B C
#> A 0 0 0
#> B 0 0 0
#> C 0 0 0
#>
default.target.fused(Slist, ns, type = "DAPV")
#> $class1
#> A B C
#> A 1.31401 0.00000 0.00000
#> B 0.00000 1.31401 0.00000
#> C 0.00000 0.00000 1.31401
#>
#> $class2
#> A B C
#> A 4.323759 0.000000 0.000000
#> B 0.000000 4.323759 0.000000
#> C 0.000000 0.000000 4.323759
#>
default.target.fused(Slist, ns, type = "DAPV", by = rep(1, length(Slist)))
#> $class1
#> A B C
#> A 1.35532 0.00000 0.00000
#> B 0.00000 1.35532 0.00000
#> C 0.00000 0.00000 1.35532
#>
#> $class2
#> A B C
#> A 1.35532 0.00000 0.00000
#> B 0.00000 1.35532 0.00000
#> C 0.00000 0.00000 1.35532
#>
# Make some (more) toy data
ns <- c(3, 4, 6, 7) # Two classes with sample size 3 and 4
Slist <- createS(ns, p = 2) # Generate four 2-dimensional covariance matrices
# Use the same target in class 1 and 2, but another in class 3 and 4:
default.target.fused(Slist, ns, by = c("A", "A", "B", "B"))
#> $class1
#> A B
#> A 2.935609 0.000000
#> B 0.000000 2.935609
#>
#> $class2
#> A B
#> A 2.935609 0.000000
#> B 0.000000 2.935609
#>
#> $class3
#> A B
#> A 1.029498 0.000000
#> B 0.000000 1.029498
#>
#> $class4
#> A B
#> A 1.029498 0.000000
#> B 0.000000 1.029498
#>