% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/beta_errors.R
\name{calculate_errors}
\alias{calculate_errors}
\title{Calculate Errors for Factor Analysis Estimates}
\usage{
calculate_errors(data, A, D, estimation_results)
}
\arguments{
\item{data}{Matrix of BFM data.}

\item{A}{Matrix of true factor loadings.}

\item{D}{Matrix of true uniquenesses (diagonal matrix).}

\item{estimation_results}{A list containing \code{A_hat} (estimated loadings)
and \code{D_hat} (estimated uniquenesses).}
}
\value{
A named vector containing:
\item{MSEA}{Mean Squared Error for factor loadings.}
\item{MSED}{Mean Squared Error for uniqueness estimates.}
\item{LSA}{Relative error for factor loadings.}
\item{LSD}{Relative error for uniqueness estimates.}
}
\description{
This function calculates the Mean Squared Error (MSE) and
relative error for factor loadings and uniqueness estimates.
}
\examples{
set.seed(123)
n <- 10
p <- 5
A <- matrix(runif(p * p, -1, 1), nrow = p)
D <- diag(runif(p, 1, 2))
data <- matrix(runif(n * p), nrow = n)
estimation_results <- list(A_hat = A, D_hat = D)
errors <- calculate_errors(data, A, D, estimation_results)
print(errors)
}
