Learn R Programming

archetypal (version 1.0.0)

check_Bmatrix: Function which checks B matrix of Archetypal Analysis Y ~ A B Y in order to find the used rows for creating each archetype and the relevant used weights.

Description

Function which checks B matrix of Archetypal Analysis Y ~ A B Y in order to find the used rows for creating each archetype and the relevant used weights.

Usage

check_Bmatrix(B, print.details = TRUE)

Arguments

B

The \(kappas \times n\) matrix such that Y ~ Y - ABY or Frobenius norm ||Y-ABY|| is minimum

print.details

If set to TRUE, then results are printed out.

Value

A list with members:

  1. used_rows, a list with used rows for creating each archetype

  2. used_weights, a list with the relevant weights that have been used

See Also

archetypal

Examples

Run this code
# NOT RUN {
# Create a small 2D data set from 3 corner-points:
p1=c(1,2);p2=c(3,5);p3=c(7,3) 
dp=rbind(p1,p2,p3);dp
set.seed(916070)
pts=t(sapply(1:20, function(i,dp){
  cc=runif(3)
  cc=cc/sum(cc)
  colSums(dp*cc)
},dp))
df=data.frame(pts)
colnames(df)=c("x","y")
# Run AA:
aa=archetypal(df=df,kappas = 3,verbose=FALSE)
# Check B matrix:
B=aa$B
yy=check_Bmatrix(B)
yy$used_rows
yy$used_weights
#
# }

Run the code above in your browser using DataLab