do_alphas_rss: Alphas and RSS of every set of archetypoids

Description Usage Arguments Value Author(s) See Also Examples

View source: R/do_alphas_rss.R

Description

In the ADALARA algorithm, every time that a set of archetypoids is computed using a sample of the data, the alpha coefficients and the associated residual sum of squares (RSS) for the entire data set must be computed.

Usage

1
2
do_alphas_rss(data, subset, huge, k_subset, rand_obs, alphas_subset, 
              type_alg = "ada", PM, prob)

Arguments

data

Data matrix with all the observations.

subset

Data matrix with a sample of the data observations.

huge

Penalization added to solve the convex least squares problems.

k_subset

Archetypoids obtained from subset.

rand_obs

Sample observations that form subset.

alphas_subset

Alpha coefficients related to k_subset.

type_alg

String. Options are 'ada' for the non-robust multivariate adalara algorithm, 'ada_rob' for the robust multivariate adalara algorithm, 'fada' for the non-robust fda fadalara algorithm and 'fada_rob' for the robust fda fadalara algorithm.

PM

Penalty matrix obtained with eval.penalty. Needed when type_alg = 'fada' or type_alg = 'fada_rob'.

prob

Probability with values in [0,1]. Needed when type_alg = 'ada_rob' or type_alg = 'fada_rob'.

Value

A list with the following elements:

Author(s)

Guillermo Vinue

See Also

archetypoids_norm_frob

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
data(mtcars)
data <- mtcars
n <- nrow(data)
m <- 10

k <- 3 
numRep <- 2
huge <- 200

suppressWarnings(RNGversion("3.5.0"))
set.seed(1)
rand_obs_si <- sample(1:n, size = m) 

si <- data[rand_obs_si,]
ada_si <- do_ada(si, k, numRep, huge, FALSE) 

k_si <- ada_si$cases
alphas_si <- ada_si$alphas
colnames(alphas_si) <- rownames(si)     

rss_si <- do_alphas_rss(data, si, huge, k_si, rand_obs_si, alphas_si, "ada")
str(rss_si)
                                 

adamethods documentation built on Aug. 4, 2020, 5:08 p.m.