The parameters are taking value of NA [Kindly refer the image]. Did I missed any part of the code related to the information "temp = as.integer(commandArgs(trailingOnly = TRUE))"
Summary-level simulations with balanced pleiotropy and InSIDE assumption violated rm(list = ls()) library(data.table) library(dplyr) library(MASS) library(MendelianRandomization) library(MRMix) library(mr.raps) library(MRPRESSO) library(penalized) source("MR_lasso.R") thetavec = c(0.2, 0, -0.2) thetaUvec = c(0.3, 0.5) Nvec = c(5e4, 8e4, 1e5, 1.5e5, 2e5, 5e5, 1e6) # 1:7 prop_invalid_vec = c(0.3, 0.5, 0.7) temp = as.integer(commandArgs(trailingOnly = TRUE)) theta = thetavec[temp[1]] # True causal effect from X to Y thetaU = thetaUx = thetaUvec[temp[2]] # Effect of the confounder on Y/X N = Nvec[temp[3]] # Sample size for exposure X
prop_invalid = prop_invalid_vec[temp[4]] # Proportion of invalid IVs pthr = 5e-8 # p-value threshold for instrument selection
NxNy_ratio = 2 # Ratio of sample sizes for X and Y M = 2e5 # Total number of independent SNPs representing the common variants in the genome
Model parameters for effect size distribution
pi1=0.02*(1-prop_invalid); pi3=0.01 pi2=0.02prop_invalid; sigma2x = sigma2y = 5e-5; sigma2u = 1e-4; sigma2x_td = sigma2y_td = (5e-5)-thetaUthetaUx*sigma2u
print(paste("N", N, "pthr", pthr, "pi1", pi1, "theta", theta, "thetaU", thetaU, "prop_invalid", prop_invalid, "NxNy_ratio", NxNy_ratio))