Description Usage Arguments Value Author(s) See Also Examples
View source: R/do_alphas_rss.R
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.
| 1 2 | do_alphas_rss(data, subset, huge, k_subset, rand_obs, alphas_subset, 
              type_alg = "ada", PM, prob)
 | 
| 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
 | 
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.
Guillermo Vinue
| 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)
                                 
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.