Description Usage Arguments Value Note Author(s) References See Also Examples

Alternating Least Squares algorithm for the minimization of the Candecomp/Parafac loss function.

1 |

`X` |
Matrix (or data.frame coerced to a matrix) of order ( |

`n` |
Number of |

`m` |
Number of |

`p` |
Number of |

`r` |
Number of extracted components |

`ort1` |
Type of constraints on |

`ort2` |
Type of constraints on |

`ort3` |
Type of constraints on |

`start` |
Starting point (0 for starting point of the algorithm from SVD's, 1 for random starting point (orthonormalized component matrices), 2 for user specified components |

`conv` |
Convergence criterion |

`maxit` |
Maximal number of iterations |

`A` |
Optional (necessary if start=2) starting value for |

`B` |
Optional (necessary if start=2) starting value for |

`C` |
Optional (necessary if start=2) starting value for |

A list including the following components:

`A` |
Component matrix for the |

`B` |
Component matrix for the |

`C` |
Component matrix for the |

`f` |
Loss function value |

`fp` |
Fit value expressed as a percentage |

`iter` |
Number of iterations |

`tripcos` |
Minimal triple cosine between two components across three component matrices (to inspect degeneracy) |

`mintripcos` |
Minimal triple cosine during the iterative algorithm observed at every 10 iterations (to inspect degeneracy) |

`ftiter` |
Matrix containing in each row the function value and the minimal triple cosine at every 10 iterations |

`cputime` |
Computation time |

The loss function to be minimized is *sum(k)|| X(k) - A D(k) B' ||^2*, where *D(k)* is a diagonal matrix holding the `k`

-th row of `C`

.

`CPfuncrep`

is the same as `CPfunc`

except that all printings are suppressed. Thus, `CPfuncrep`

can be helpful for simulation experiments.

Maria Antonietta Del Ferraro [email protected]

Henk A.L. Kiers [email protected]

Paolo Giordani [email protected]

R.A. Harshman (1970). Foundations of the Parafac procedure: models and conditions for an ‘explanatory’ multi-mode factor analysis. *UCLA Working Papers in Phonetics 16:1–84*.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ```
data(TV)
TVdata=TV[[1]]
# permutation of the modes so that the A-mode refers to students
TVdata <- permnew(TVdata, 16, 15, 30)
TVdata <- permnew(TVdata, 15, 30, 16)
# unconstrained CP solution using two components
# (rational starting point by SVD [start=0])
TVcp <- CPfuncrep(TVdata, 30, 16, 15, 2, 1, 1, 1, 0, 1e-6, 10000)
# constrained CP solution using two components with orthogonal A-mode
# component matrix (rational starting point by SVD [start=0])
TVcp <- CPfuncrep(TVdata, 30, 16, 15, 2, 2, 1, 1, 0, 1e-6, 10000)
# constrained CP solution using two components with orthogonal A-mode
# component matrix and zero correlated C-mode component matrix
# (rational starting point by SVD [start=0])
TVcp <- CPfuncrep(TVdata, 30, 16, 15, 2, 2, 1, 3, 0, 1e-6, 10000)
# unconstrained CP solution using two components
# (random orthonormalized starting point [start=1])
TVcp <- CPfuncrep(TVdata, 30, 16, 15, 2, 1, 1, 1, 1, 1e-6, 10000)
# unconstrained CP solution using two components (user starting point [start=2])
TVcp <- CPfuncrep(TVdata, 30, 16, 15, 2, 1, 1, 1, 2, 1e-6, 10000,
matrix(rnorm(30*2),nrow=30), matrix(rnorm(16*2),nrow=16),
matrix(rnorm(15*2),nrow=15))
``` |

ThreeWay documentation built on May 29, 2017, 11:52 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.