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 |
huge |
Penalization added to solve the convex least squares problems. |
k_subset |
Archetypoids obtained from |
rand_obs |
Sample observations that form |
alphas_subset |
Alpha coefficients related to |
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 |
prob |
Probability with values in [0,1]. Needed when
|
Value
A list with the following elements:
rss Real number of the residual sum of squares.
resid_rss Matrix with the residuals.
alphas Matrix with the alpha values.
Author(s)
Guillermo Vinue
See Also
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)