## Archetypoid algorithm with the functional multivariate Frobenius norm

### Description

Archetypoid algorithm with the functional multivariate Frobenius norm to be used with functional data.

### Usage

```archetypoids_funct_multiv(numArchoid, data, huge = 200, ArchObj, PM)
```

### Arguments

 `numArchoid` Number of archetypoids. `data` Data matrix. Each row corresponds to an observation and each column corresponds to a variable. All variables are numeric. `huge` Penalization added to solve the convex least squares problems. `ArchObj` The list object returned by the `stepArchetypesRawData_funct` function. `PM` Penalty matrix obtained with `eval.penalty`.

### Value

A list with the following elements:

• cases: Final vector of archetypoids.

• rss: Residual sum of squares corresponding to the final vector of archetypoids.

• archet_ini: Vector of initial archetypoids.

• alphas: Alpha coefficients for the final vector of archetypoids.

• resid: Matrix with the residuals.

Irene Epifanio

### References

Epifanio, I., Functional archetype and archetypoid analysis, 2016. Computational Statistics and Data Analysis 104, 24-34, https://doi.org/10.1016/j.csda.2016.06.007

`archetypoids`

### Examples

```## Not run:
library(fda)
?growth
str(growth)
hgtm <- growth\$hgtm
hgtf <- growth\$hgtf[,1:39]

# Create array:
nvars <- 2
data.array <- array(0, dim = c(dim(hgtm), nvars))
data.array[,,1] <- as.matrix(hgtm)
data.array[,,2] <- as.matrix(hgtf)
rownames(data.array) <- 1:nrow(hgtm)
colnames(data.array) <- colnames(hgtm)
str(data.array)

# Create basis:
nbasis <- 10
basis_fd <- create.bspline.basis(c(1,nrow(hgtm)), nbasis)
PM <- eval.penalty(basis_fd)
# Make fd object:
temp_points <- 1:nrow(hgtm)
temp_fd <- Data2fd(argvals = temp_points, y = data.array, basisobj = basis_fd)

X <- array(0, dim = c(dim(t(temp_fd\$coefs[,,1])), nvars))
X[,,1] <- t(temp_fd\$coef[,,1])
X[,,2] <- t(temp_fd\$coef[,,2])

# Standardize the variables:
Xs <- X
Xs[,,1] <- scale(X[,,1])
Xs[,,2] <- scale(X[,,2])

lass <- stepArchetypesRawData_funct_multiv(data = Xs, numArch = 3,
numRep = 5, verbose = FALSE,
saveHistory = FALSE, PM)

afm <- archetypoids_funct_multiv(3, Xs, huge = 200, ArchObj = lass, PM)
str(afm)

## End(Not run)

```