derive_varcov_list: Derive Variance-Covariance Matrix List

View source: R/SampleSize.R

derive_varcov_listR Documentation

Derive Variance-Covariance Matrix List

Description

Constructs a list of variance-covariance matrices for multiple treatment arms based on provided standard deviations, means, and correlation structures.

Usage

derive_varcov_list(
  mu_list,
  sigma_list,
  ynames_list = NULL,
  varcov_list = NULL,
  cor_mat = NULL,
  rho = 0
)

Arguments

mu_list

A list of numeric vectors representing the means (\mu) for each treatment arm. Each element corresponds to one arm.

sigma_list

A list of numeric vectors representing the standard deviations (\sigma) for each treatment arm. Each element corresponds to one arm.

ynames_list

A list of character vectors specifying the names of the endpoints for each arm. Each element corresponds to one arm.

varcov_list

(Optional) A pre-specified list of variance-covariance matrices for each arm. If provided, it will override the construction of variance-covariance matrices.

cor_mat

(Optional) A correlation matrix to be used for constructing the variance-covariance matrices when there are multiple endpoints. If dimensions do not match the number of endpoints, a warning is issued.

rho

(Optional) A numeric value specifying the constant correlation coefficient to be used between all pairs of endpoints if no correlation matrix is provided. Default is 0 (uncorrelated endpoints).

Details

This function creates a list of variance-covariance matrices for multiple treatment arms. If the varcov_list is not provided, the function uses the sigma_list to compute the matrices. For single endpoints, the variance is simply the square of the standard deviation. For multiple endpoints, the function constructs the matrices using either a provided cor_mat or the constant correlation coefficient rho.

The function ensures that the lengths of mu_list, sigma_list, and ynames_list match for each arm. If dimensions mismatch, or if neither a variance-covariance matrix (varcov_list) nor a standard deviation list (sigma_list) is provided, an error is raised.

Value

A list of variance-covariance matrices, one for each treatment arm.

Author(s)

Thomas Debray tdebray@fromdatatowisdom.com


SimTOST documentation built on April 3, 2025, 9:05 p.m.