% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/rTensor_Decomp.R
\name{indscal}
\alias{indscal}
\title{INDSCAL Decomposition}
\usage{
indscal(tnsr, num_components = NULL, max_iter = 25, tol = 1e-05)
}
\arguments{
\item{tnsr}{3-Tensor with square frontal slices}

\item{num_components}{the number of components for the decomposition}

\item{max_iter}{maximum number of iterations if error stays above \code{tol}}

\item{tol}{relative Frobenius norm error tolerance}
}
\value{
a list containing the following:\describe{
\item{\code{A}}{the shared factor matrix with \code{num_components} columns}
\item{\code{D}}{a list of diagonal weight matrices, one for each frontal slice}
\item{\code{conv}}{whether or not \code{resid} < \code{tol} by the last iteration}
\item{\code{est}}{estimate of \code{tnsr} after decomposition}
\item{\code{norm_percent}}{the percent of Frobenius norm explained by the approximation}
\item{\code{fnorm_resid}}{the Frobenius norm of the error \code{fnorm(est-tnsr)}}
\item{\code{all_resids}}{vector containing the Frobenius norm of error for all the iterations}
}
}
\description{
Individual Differences Scaling (INDSCAL) decomposition of a 3-Tensor. Decomposes a symmetric 3-Tensor into a shared factor matrix \code{A} and slice-specific diagonal weight matrices \code{D_k} such that each frontal slice \code{X_k = A \%*\% D_k \%*\% t(A)}. Uses the Alternating Least Squares (ALS) estimation procedure. For more details on INDSCAL, consult Carroll and Chang (1970).
}
\details{
A progress bar is included to help monitor operations on large tensors. The input tensor must be 3-dimensional with square frontal slices (i.e. the first two modes must be equal).
}
\note{
The first two modes of \code{tnsr} must be equal (square frontal slices).
}
\examples{
tnsr <- rand_tensor(c(4,4,3))
# make symmetric frontal slices
for(k in 1:3) tnsr[,,k] <- (tnsr[,,k] + t(tnsr[,,k]@data)) / 2
indscalD <- indscal(tnsr, num_components=2)
indscalD$conv
indscalD$norm_percent
plot(indscalD$all_resids)
}
\references{
J. Carroll, J. Chang, "Analysis of individual differences in multidimensional scaling via an N-way generalization of Eckart-Young decomposition". Psychometrika 1970.
}
\seealso{
\code{\link{cp}}, \code{\link{rescal}}
}
