% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/smm.R
\name{smm}
\alias{smm}
\title{Second Moment Method Analysis.}
\usage{
smm(mean, var, cor_mat = NULL)
}
\arguments{
\item{mean}{The mean vector.}

\item{var}{The variance vector.}

\item{cor_mat}{The correlation matrix (optional). If not provided, tasks are assumed to be independent.}
}
\value{
The function returns a list of the total mean, variance, and standard deviation for the project.
}
\description{
This function performs the Second Moment Method (SMM) analysis to estimate the
total mean, variance, and standard deviation of a project based on individual
task means, variances, and an optional correlation matrix.
}
\examples{

# Set the mean vector, variance vector, and correlation matrix for a toy project.
mean <- c(10, 15, 20)
var <- c(4, 9, 16)
cor_mat <- matrix(c(
  1, 0.5, 0.3,
  0.5, 1, 0.4,
  0.3, 0.4, 1
), nrow = 3, byrow = TRUE)

# Use the Second Moment Method to estimate the results for the project.
result <- smm(mean, var, cor_mat)
print(result)

# Without correlation matrix (independent tasks)
result <- smm(mean, var)
print(result)

# When certain tasks are discrete and others are continuous, the SMM can still
# be applied as long as the variance values accurately reflect the variability of each task.

discrete_mean <- c(5, 10)
discrete_var <- c(0, 0)
continuous_mean <- c(15, 20)
continuous_var <- c(4, 5)
mean <- c(discrete_mean, continuous_mean)
var <- c(discrete_var, continuous_var)
cor_mat <- matrix(c(
  1, 0, 0.2, 0.3,
  0, 1, 0.1, 0.2,
  0.2, 0.1, 1, 0.4,
  0.3, 0.2, 0.4,
  1
), nrow = 4, byrow = TRUE)
result <- smm(mean, var, cor_mat)
print(result)

}
\references{
Damnjanovic, Ivan, and Kenneth Reinschmidt. Data analytics for engineering and
construction project risk management. No. 172534. Cham, Switzerland: Springer, 2020.
}
