|
1 | 1 | #' Specification format for \code{calibration_control} used by |
2 | 2 | #' \code{makeData()} |
3 | | -#' |
| 3 | +#' |
4 | 4 | #' \code{calibration_control} is a named list of tuning parameters used by |
5 | 5 | #' \code{\link{makeData}} when \code{target_correlation = TRUE}. |
6 | | -#' |
| 6 | +#' |
7 | 7 | #' These settings control the numerical search used to calibrate a latent |
8 | 8 | #' Gaussian correlation matrix so that, after transformation through the |
9 | 9 | #' endpoint-specific marginals, the observed Pearson correlation matrix is |
10 | 10 | #' approximately equal to the user-supplied \code{correlation_matrix}. |
11 | | -#' |
12 | | -#' |
13 | | -#' @section Default values: The default list is: \preformatted{ list( n_mc = |
14 | | -#' 10000, tol = 0.001, maxit = 100, rho_cap = 0.999, ensure_pd = TRUE, |
15 | | -#' conv_norm_type = "F" ) } |
16 | | -#' @section Arguments: \describe{ \item{list("n_mc")}{ Monte Carlo sample size |
17 | | -#' used internally when approximating the transformed correlation induced by a |
18 | | -#' candidate latent Gaussian correlation. Larger values generally improve |
19 | | -#' numerical stability but increase computation time. } |
20 | | -#' |
21 | | -#' \item{list("tol")}{ Positive numeric tolerance passed to the one-dimensional |
22 | | -#' root-finding routine used in pairwise calibration. Smaller values can |
23 | | -#' improve accuracy but may require more iterations and computation. } |
24 | | -#' |
25 | | -#' \item{list("maxit")}{ Positive integer giving the maximum number of |
26 | | -#' root-finding iterations. } |
27 | | -#' |
28 | | -#' \item{list("rho_cap")}{ Numeric scalar in (0,1) giving the maximum absolute |
29 | | -#' latent Gaussian correlation considered during calibration. This avoids |
30 | | -#' numerical instability at the exact boundaries \eqn{(\pm 1}). } |
31 | | -#' |
32 | | -#' \item{list("ensure_pd")}{ Logical scalar. If \code{TRUE}, the calibrated |
33 | | -#' latent correlation matrix is repaired (if needed) to ensure it is a valid |
34 | | -#' positive-definite correlation matrix before simulation proceeds. } |
35 | | -#' |
36 | | -#' \item{list("conv_norm_type")}{ Character scalar passed through to |
37 | | -#' positive-definiteness repair routines (for example, |
38 | | -#' \code{Matrix::nearPD(..., conv.norm.type = ...)} when available). The |
39 | | -#' default \code{"F"} (Frobenius)). } } |
| 11 | +#' |
| 12 | +#' @section Default values: |
| 13 | +#' The default list is: |
| 14 | +#' \preformatted{ |
| 15 | +#' list( |
| 16 | +#' n_mc = 10000, |
| 17 | +#' tol = 0.001, |
| 18 | +#' maxit = 100, |
| 19 | +#' rho_cap = 0.999, |
| 20 | +#' ensure_pd = TRUE, |
| 21 | +#' conv_norm_type = "F" |
| 22 | +#' ) |
| 23 | +#' } |
| 24 | +#' |
| 25 | +#' @section Arguments: |
| 26 | +#' \describe{ |
| 27 | +#' \item{n_mc}{ |
| 28 | +#' Monte Carlo sample size used internally when approximating the |
| 29 | +#' transformed correlation induced by a candidate latent Gaussian |
| 30 | +#' correlation. Larger values generally improve numerical stability but |
| 31 | +#' increase computation time. |
| 32 | +#' } |
| 33 | +#' \item{tol}{ |
| 34 | +#' Positive numeric tolerance passed to the one-dimensional root-finding |
| 35 | +#' routine used in pairwise calibration. Smaller values can improve |
| 36 | +#' accuracy but may require more iterations and computation. |
| 37 | +#' } |
| 38 | +#' \item{maxit}{ |
| 39 | +#' Positive integer giving the maximum number of root-finding iterations. |
| 40 | +#' } |
| 41 | +#' \item{rho_cap}{ |
| 42 | +#' Numeric scalar in \eqn{(0,1)} giving the maximum absolute latent |
| 43 | +#' Gaussian correlation considered during calibration. This avoids |
| 44 | +#' numerical instability at the exact boundaries \eqn{\pm 1}. |
| 45 | +#' } |
| 46 | +#' \item{ensure_pd}{ |
| 47 | +#' Logical scalar. If \code{TRUE}, the calibrated latent correlation |
| 48 | +#' matrix is repaired, if needed, to ensure it is a valid |
| 49 | +#' positive-definite correlation matrix before simulation proceeds. |
| 50 | +#' } |
| 51 | +#' \item{conv_norm_type}{ |
| 52 | +#' Character scalar passed through to positive-definiteness repair |
| 53 | +#' routines, for example |
| 54 | +#' \code{Matrix::nearPD(..., conv.norm.type = ...)} when available. |
| 55 | +#' The default is \code{"F"} (Frobenius norm). |
| 56 | +#' } |
| 57 | +#' } |
| 58 | +#' |
40 | 59 | #' @section When calibration is used: |
41 | | -#' |
42 | | -#' These settings are used only when: \itemize{ \item \code{correlation_matrix} |
43 | | -#' is not \code{NULL}, and \item \code{target_correlation = TRUE}. } |
44 | | -#' |
45 | | -#' If \code{target_correlation = FALSE}, the supplied \code{correlation_matrix} |
46 | | -#' is used directly as the latent Gaussian correlation matrix, and |
47 | | -#' \code{calibration_control} is ignored. In general, it is recommended that |
48 | | -#' \code{target_correlation = TRUE}. |
49 | | -#' @section Practical guidance: \itemize{ \item In many applications, the |
50 | | -#' defaults have been observed to be sufficient. \item If the estimated |
51 | | -#' correlation matrices differ substantially from the target, the increasing |
52 | | -#' \code{n_mc} will usually have the most impact. Note that increasing this |
53 | | -#' value will increase computation time. \item When all simulated endpoints |
54 | | -#' are continuous Gaussian, target_correlation = FALSE may be used as Pearson |
55 | | -#' correlation is preserved under the normal marginal transformation and no |
56 | | -#' calibration is needed. This may be especially important in simulation |
57 | | -#' studies as this will save computation time. %\item For publication-quality |
58 | | -#' simulation studies where observed Pearson correlation matching is important, |
59 | | -#' % increasing \code{n_mc} may improve stability. %\item If calibration |
60 | | -#' becomes slow, consider reducing \code{n_mc}, loosening \code{tol}, or using |
61 | | -#' % \code{target_correlation = FALSE} when the latent Gaussian correlation is |
62 | | -#' acceptable. \item Even with calibration, finite-sample summaries from the |
63 | | -#' simulated data will not match the target matrix exactly. \item Please note |
64 | | -#' that not all combinations of endpoint marginals and target Pearson |
65 | | -#' correlations are feasible, so some requested correlation structures may be |
66 | | -#' unattainable under the specified data-generating distributions. } |
67 | | -#' @seealso \code{\link{makeData}} for the main simulation routine. |
68 | | -#' |
| 60 | +#' These settings are used only when: |
| 61 | +#' \itemize{ |
| 62 | +#' \item \code{correlation_matrix} is not \code{NULL}, and |
| 63 | +#' \item \code{target_correlation = TRUE}. |
| 64 | +#' } |
| 65 | +#' |
| 66 | +#' If \code{target_correlation = FALSE}, the supplied |
| 67 | +#' \code{correlation_matrix} is used directly as the latent Gaussian |
| 68 | +#' correlation matrix, and \code{calibration_control} is ignored. In general, |
| 69 | +#' it is recommended that \code{target_correlation = TRUE}. |
| 70 | +#' |
| 71 | +#' @section Practical guidance: |
| 72 | +#' \itemize{ |
| 73 | +#' \item In many applications, the defaults have been observed to be |
| 74 | +#' sufficient. |
| 75 | +#' \item If the estimated correlation matrices differ substantially from the |
| 76 | +#' target, increasing \code{n_mc} will usually have the most impact. Note |
| 77 | +#' that increasing this value will increase computation time. |
| 78 | +#' \item When all simulated endpoints are continuous Gaussian, |
| 79 | +#' \code{target_correlation = FALSE} may be used, since Pearson correlation |
| 80 | +#' is preserved under the normal marginal transformation and no calibration |
| 81 | +#' is needed. |
| 82 | +#' \item Even with calibration, finite-sample summaries from the simulated |
| 83 | +#' data will not match the target matrix exactly. |
| 84 | +#' \item Not all combinations of endpoint marginals and target Pearson |
| 85 | +#' correlations are feasible, so some requested correlation structures may |
| 86 | +#' be unattainable under the specified data-generating distributions. |
| 87 | +#' } |
| 88 | +#' |
| 89 | +#' @seealso |
| 90 | +#' \code{\link{makeData}} for the main simulation routine. |
| 91 | +#' |
69 | 92 | #' \code{\link{endpoint_details}} for endpoint definitions. |
70 | | -#' |
| 93 | +#' |
71 | 94 | #' \code{\link{enrollment_details}} for follow-up and enrollment settings. |
| 95 | +#' |
72 | 96 | #' @name calibration_control |
73 | 97 | #' @keywords documentation |
74 | 98 | #' @examples |
75 | | -#' |
76 | 99 | #' ## Default settings |
77 | 100 | #' calibration_control <- list( |
78 | 101 | #' n_mc = 10000, |
|
82 | 105 | #' ensure_pd = TRUE, |
83 | 106 | #' conv_norm_type = "F" |
84 | 107 | #' ) |
85 | | -#' |
| 108 | +#' |
86 | 109 | #' ## Higher-precision example |
87 | 110 | #' calibration_control <- list( |
88 | 111 | #' n_mc = 50000, |
|
92 | 115 | #' ensure_pd = TRUE, |
93 | 116 | #' conv_norm_type = "F" |
94 | 117 | #' ) |
95 | | -#' |
96 | 118 | NULL |
0 commit comments