Learn R Programming

ThreeWay (version 1.1.3)

CPfitpartitioning: Fit of each entity per mode

Description

Computation of fit contributions.

Usage

CPfitpartitioning(Xprep, n, m, p, A, B, C, laba, labb, labc)

Arguments

Xprep
Matrix (or data.frame coerced to a matrix) of order (n x mp) containing the matricized array (frontal slices)
n
Number of A-mode entities
m
Number of B-mode entities
p
Number of C-mode entities
A
Component matrix for the A-mode
B
Component matrix for the B-mode
C
Component matrix for the C-mode
laba
Optional vector of length n containing the labels of the A-mode entities
labb
Optional vector of length m containing the labels of the B-mode entities
labc
Optional vector of length p containing the labels of the C-mode entities

Value

A list including the following components:
fitA
Fit contribution for the A-mode entities
fitB
Fit contribution for the B-mode entities
fitC
Fit contribution for the C-mode entities

See Also

CP

Examples

Run this code
data(TV)
TVdata=TV[[1]]
labSCALE=TV[[2]]
labPROGRAM=TV[[3]]
labSTUDENT=TV[[4]]
# permutation of the modes so that the A-mode refers to students
TVdata <- permnew(TVdata, 16, 15, 30)
TVdata <- permnew(TVdata, 15, 30, 16)
# CP solution
TVcp <- CPfuncrep(TVdata, 30, 16, 15, 2, 1, 1, 1, 0, 1e-6, 10000)
# Fitpartitioning of the CP solution
FitCP <-  CPfitpartitioning(TVdata, 30, 16, 15, TVcp$A, TVcp$B, TVcp$C, 
 labSTUDENT, labSCALE, labPROGRAM)
# Fitpartitioning of the CP solution (when labels are not available)
FitCP <-  CPfitpartitioning(TVdata, 30, 16, 15, TVcp$A, TVcp$B, TVcp$C)

Run the code above in your browser using DataLab