% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/SimulateMultiBlock.R
\name{SimulateMultiBlock}
\alias{SimulateMultiBlock}
\title{SimulateMultiBlock}
\usage{
SimulateMultiBlock(
  n = 500L,
  p = 2000L,
  n_sources = 4L,
  noise = 0.05,
  n_blocks = 2L
)
}
\arguments{
\item{n}{Number of samples. Default: \code{500}.}

\item{p}{Total number of variables (split evenly across blocks). Must be
divisible by \code{n_blocks} and by \code{n_sources}. Default: \code{2000}.}

\item{n_sources}{Number of orthogonal latent sources. Default: \code{4}.}

\item{noise}{Fraction of total variance attributed to noise, in (0, 1).
Default: \code{0.05} (5 \% noise).}

\item{n_blocks}{Number of blocks to split the variables into. Default:
\code{2}.}
}
\value{
A \code{\link{MultiBlock}} object with \code{n_blocks} blocks, each
  of size \eqn{n \times (p / \text{n\_blocks})}, named \code{"Block1"},
  \code{"Block2"}, etc.
}
\description{
Generate a synthetic \code{MultiBlock} dataset built from a known number of
orthogonal latent sources plus Gaussian noise.  Useful for benchmarking and
testing ComDim functions.
}
\details{
The dataset is constructed as follows:
\enumerate{
  \item \code{n_sources} score vectors (\eqn{n \times \text{n\_sources}}) are
    drawn from a standard normal distribution and orthonormalised by QR
    decomposition.
  \item Loading vectors (\eqn{\text{n\_sources} \times p}) are built so that
    each source loads primarily (SD = 1) on one equal-sized variable segment,
    with small cross-loadings (SD = 0.10) on the remaining variables.
  \item The true signal \eqn{X = TP} is computed.
  \item Gaussian noise is added such that
    \eqn{\text{noise\_var} = \text{signal\_var} \times
    \text{noise} / (1 - \text{noise})}.
  \item The \eqn{p} variables are split into \code{n_blocks} equal-width
    blocks, each assembled as a named element of the returned
    \code{MultiBlock}.
}
}
\examples{
mb <- SimulateMultiBlock(n = 100, p = 200, n_sources = 4,
                         noise = 0.05, n_blocks = 2)
mb <- NormalizeMultiBlock(mb, method = 'norm')
res <- ComDim_PCA(mb, ndim = 4)
}
\seealso{
\code{\link{ComDim_PCA}}, \code{\link{MultiBlock}}
}
