| mr_cML | R Documentation | 
Constrained maximum likelihood (cML) based Mendelian Randomization method robust to both correlated and uncorrelated pleiotropy.
mr_cML(
  object,
  MA = TRUE,
  DP = TRUE,
  K_vec = 0:(length(object@betaX) - 2),
  random_start = 0,
  num_pert = 200,
  random_start_pert = 0,
  maxit = 100,
  random_seed = 314,
  n,
  Alpha = 0.05
)
## S4 method for signature 'MRInput'
mr_cML(
  object,
  MA = TRUE,
  DP = TRUE,
  K_vec = 0:(length(object@betaX) - 2),
  random_start = 0,
  num_pert = 200,
  random_start_pert = 0,
  maxit = 100,
  random_seed = 314,
  n,
  Alpha = 0.05
)
| object | An  | 
| MA | Whether model average is applied or not. Default is TRUE. | 
| DP | Whether data perturbation is applied or not. Default is TRUE. | 
| K_vec | Set of candidate K's, the constraint parameter representing number of invalid IVs. Default is from 0 to (#IV - 2). | 
| random_start | Number of random starting points for cML, default is 0. | 
| num_pert | Number of perturbation when DP is TRUE, default is 200. | 
| random_start_pert | Number of random start points for cML with data perturbation, default is 0. | 
| maxit | Maximum number of iterations for each optimization. Default is 100. | 
| random_seed | Random seed, default is 314. When  | 
| n | Sample size. When sample sizes of GWAS for exposure and outcome are different, and/or when sample sizes of different SNPs are different, the smallest sample size is recommended to get conservative result and avoid type-I error. See reference for more discussions. | 
| Alpha | Significance level for the confidence interval for estimate, default is 0.05. | 
The MRcML method selects invalid IVs with correlated
and/or uncorrelated peliotropic effects using constrained maximum
likelihood. cML-BIC gives results of the selected model with 
original data, while cML-MA-BIC averages over all candidate models.
cML-BIC-DP and cML-MA-BIC-DP are the versions with 
data-perturbation to account for selection uncertainty when 
many invalid IVs have weak pleiotropic effects. 
When DP is performed, two goodness-of-fit (GOF) tests are developed to check whether the model-based and DP- based variance estimates converge to the same estimate. Small p-values of GOF tests indicate selection uncertainty is not ignorable, and results from DP is more reliable. See reference for more details.
As the constrained maximum likelihood function is non-convex, multiple random starting points could be used to find a global minimum. For some starting points the algorithm may not converge and a warning message will be prompted, typically this will not affect the results.
The output from the function is an MRcML object containing:
| Exposure | A character string giving the name given to the exposure. | 
| Outcome | A character string giving the name given to the outcome. | 
| Estimate | Estimate of theta. | 
| StdError | Standard error of estimate. | 
| Pvalue | p-value of estimate. | 
| BIC_invalid | Set of selected invalid IVs if cML-BIC is performed, i.e. without MA or DP. | 
| GOF1_p | p-value of the first goodness-of-fit test. | 
| GOF2_p | p-value of the second goodness-of-fit test. | 
| SNPs | The number of SNPs that were used in the calculation. | 
| Alpha | Significance level for the confidence interval for estimate, default is 0.05. | 
| CILower | Lower bound of the confidence interval for estimate. | 
| CIUpper | Upper bound of the confidence interval for estimate. | 
| MA | Indicator of whether model average is applied. | 
| DP | Indicator of whether data perturbation is applied. | 
Xue, H., Shen, X., & Pan, W. (2021). Constrained maximum likelihood-based Mendelian randomization robust to both correlated and uncorrelated pleiotropic effects. The American Journal of Human Genetics, 108(7), 1251-1269.
# Perform cML-MA-BIC-DP:
mr_cML(mr_input(bx = ldlc, bxse = ldlcse, by = chdlodds,
byse = chdloddsse), num_pert=5, MA = TRUE, DP = TRUE, n = 17723)
# num_pert is set to 5 to reduce computational time
# the default value of 200 is recommended in practice
# Perform cML-BIC-DP:
mr_cML(mr_input(bx = ldlc, bxse = ldlcse, by = chdlodds,
byse = chdloddsse), MA = TRUE, DP = FALSE,, n = 17723)
   
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.