do_alphas_rss {adamethods}R Documentation

Alphas and RSS of every set of archetypoids

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

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

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)
                                 

[Package adamethods version 1.2.1 Index]