Scales the Candecomp/Parafac solution producing two component matrices normalized to unit sum of squares (and compensating this scaling in the remaining component matrix).
renormsolCP(A, B, C, mode)
Arguments
A: Component matrix for the A-mode
B: Component matrix for the B-mode
C: Component matrix for the C-mode
mode: Scaling option (1 if scaling for B- and C-modes, 2 if scaling for A- and C-modes, 3 if scaling for A- and B-modes)
Returns
A list including the following components: - A: Component matrix for the A-mode after normalization
B: Component matrix for the B-mode after normalization
C: Component matrix for the C-mode after normalization
data(TV)TVdata=TV[[1]]# permutation of the modes so that the A-mode refers to studentsTVdata <- permnew(TVdata,16,15,30)TVdata <- permnew(TVdata,15,30,16)# CP solutionTVcp <- CPfuncrep(TVdata,30,16,15,2,1,1,1,0,1e-6,10000)# sums of squares of A, B and Csum(TVcp$A^2)sum(TVcp$B^2)sum(TVcp$C^2)# Renormalization by scaling B- and C-modesTVcpScalBC <- renormsolCP(TVcp$A, TVcp$B, TVcp$C,1)# sums of squares of A, B and C after renormalizationsum(TVcpScalBC$A^2)sum(TVcpScalBC$B^2)sum(TVcpScalBC$C^2)