derive_varcov_list | R Documentation |
Constructs a list of variance-covariance matrices for multiple treatment arms based on provided standard deviations, means, and correlation structures.
derive_varcov_list(
mu_list,
sigma_list,
ynames_list = NULL,
varcov_list = NULL,
cor_mat = NULL,
rho = 0
)
mu_list |
A list of numeric vectors representing the means ( |
sigma_list |
A list of numeric vectors representing the standard deviations ( |
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). |
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.
A list of variance-covariance matrices, one for each treatment arm.
Thomas Debray tdebray@fromdatatowisdom.com
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.