diff --git a/multiple_iv_simulations/01_indep_differential.R b/multiple_iv_simulations/01_indep_differential.R index 5f2eb68..8bb28a6 100755 --- a/multiple_iv_simulations/01_indep_differential.R +++ b/multiple_iv_simulations/01_indep_differential.R @@ -1,16 +1,9 @@ #!/usr/bin/env Rscript library(argparser) -library(mecor) library(ggplot2) library(data.table) library(filelock) library(arrow) -library(Amelia) -library(Zelig) -library(predictionError) -options(amelia.parallel="no", - amelia.ncpus=1) -setDTthreads(40) source("simulation_base.R") @@ -31,8 +24,9 @@ simulate_data <- function(N, accuracy_imbalance_difference = 0.3) { set.seed(seed) # make w and y dependent - z <- rbinom(N, 1, plogis(qlogis(Pz))) - x <- rbinom(N, 1, plogis(Bzx * z + qlogis(Px))) + l <- rnorm(N) + z <- rbinom(N, 1, plogis(qlogis(Pz)+Bzx*l)) + x <- rbinom(N, 1, plogis(-1*Bzx*l + qlogis(Px))) y.var.epsilon <- (var(Bzy * z) + var(Bxy * x) + 2 * cov(Bzy * z, Bxy * x)) * ((1 - y_explained_variance) / y_explained_variance) y.epsilon <- rnorm(N, sd = sqrt(y.var.epsilon)) diff --git a/multiple_iv_simulations/Makefile b/multiple_iv_simulations/Makefile index 9681d0a..9c9e023 100644 --- a/multiple_iv_simulations/Makefile +++ b/multiple_iv_simulations/Makefile @@ -2,7 +2,7 @@ SHELL=bash Ns=[1000,5000,10000] -ms=[100,200,400] +ms=[100,200,400,1000] seeds=[$(shell seq -s, 1 500)] explained_variances=[0.1] @@ -17,7 +17,7 @@ joblists:example_1_jobs example_2_jobs example_3_jobs grid_sweep_script=../simulations/grid_sweep.py example_1_jobs: 01_indep_differential.R simulation_base.R ${grid_sweep_script} skx_dev.sbatch ../misclassificationmodels - ${srun} uv run ${grid_sweep_script} --command 01_indep_differential.R --arg_dict '{"N":${Ns},"m":${ms},"seed":${seeds},"outfile":["example_1.feather"],"y_explained_variance":${explained_variances},"Bzx":[1]}' --outfile example_1_jobs --remember_file=remember_grid_sweep.rds + ${srun} uv run ${grid_sweep_script} --command 01_indep_differential.R --arg_dict '{"N":${Ns},"m":${ms},"seed":${seeds},"outfile":["example_1.feather"],"y_explained_variance":${explained_variances},"Bzx":[1],"prediction_accuracy":0.825}' --outfile example_1_jobs --remember_file=remember_grid_sweep.rds example_1.feather: example_1_jobs my_pylauncher.py sbatch -J "multiple iv measerr correction" spr_2.sbatch my_pylauncher.py $< --cores 1