These are the R scripts and numerical results accompanying Bartoszek, and Pułka "Convergence and simulation of centred kernel quadratic stochastic operators".
The R setup for the manuscript was as follows: R version 4.0.3 (2020-10-10) Platform: x86_64-pc-linux-gnu (64-bit) Running under: openSUSE Leap 15.2
The exact output can depend on the random seed. However, in the script we have the option of rerunning the analyses as it was in the manuscript, i.e. the random seeds that were used to generate the results are saved, included and can be read in.
The code is divided into several directories with scripts, random seeds and result files. In order to run the analyses one runs source("CKQSOsim_torun.R") in R. In the file CKQSOsim_setups.R one defines the all the simulation setups that one wants. The list with the setups has to be passed to the variable l_do_setups (in CKQSOsim_torun.R). A setup is a list with the following fields:
-
n: the number of generation
-
pop_size: the sample size
-
delta: value of delta in Thm. 4
-
alpha: value of alpha in Thm. 4
-
rG: sampling function of the kernel distribution
-
rG_pop: sampling function of the kernel distribution for Alg. 1, the population simulation algorithm, needs to take in as parameters the trait values of the two parents
-
vG: variance of G distribution
-
rF: sampling function of the initial distribution
-
vF: variance of F distribution
-
m: mean value of F distribution
-
otherparams: a list with possible stearing parameters, at the moment it is unused
-
b_dosimul: logical, should the simulation be performed (TRUE) or its results read in from an RData file (FALSE, RData file is automatically constructed based as c_fileprefix.RData
-
b_doplot: logical, should plots of the simulation be done (TRUE)
-
b_dosave: logical, should the results be saved (TRUE), unused at the moment
-
c_fileprefix: the prefix for result and plot files
-
res_exact: result of Alg. 2 simulation (unused)
-
res_approxBT: result of Alg. 3 simulation with the Bonferroni type correction (unused)
-
res_approxBT: result of Alg. 3 simulation without the Bonferroni type correction (unused)
-
res_popAlg=NULL: result of Alg. 1 simulation (unused)
-
legendpos: position of the legends for the plots
-
b_replicate: logical, should a new simulation be done (FALSE) or should the simulation be replicated based on read-in random seeds (from c_fileprefix.RData file)
-
b_save_seeds: logical, should the random seeds be saved (TRUE) or not (FALSE)
-
b_exact: logical, should the simulations according to Alg. 2 be run (TRUE)
-
b_approxBT: logical, should the simulations according to Alg. 3 with the Bonferroni type correction be run (TRUE)
-
b_approxBF: logical, should the simulations according to Alg. 3 without the Bonferroni type correction be run (TRUE)
-
b_popAlg: logical, should the simulations according to Alg. 1 be run (TRUE)
The result and plot files are all in the same directory as the scripts. The output files have been moved to the Results folder for clarity here. However, in order to replicate the study, all the RData files need to be copied from the Results folder into the directory where the R scripts are. This is in order for them to be able to read in the random seeds.