Function to run benchmarks on attractor-based simulations
run_attractor_sim_benchmarks.RdThis function benchmarks a provided list of modeling methods on attractor-based simulation datasets. It simulates data multiple times, fits each modeling method to the simulated data, and records the results and computation times for each step.
Arguments
- seed_data
A data frame containing the seed dataset with columns:
gene,coord_x,coord_y, andcount. Will be given toattractor_simulationto generate simulations.- n_sims
An integer specifying the number of simulations to run. Default is 100.
- n_bins
An integer specifying the number of spatial bins to divide the data coordinates into for each simulation. Default is 100.
- n_replicates
An integer specifying the number of replicates to generate for each treatment condition in each simulation. Default is 4.
- replicate_spatial_scalar
A numeric value controlling the amount of spatial variation introduced in each replicate for each simulation. Default is 0.05.
- min_effect_size
A numeric value specifying the minimum effect size for functional spatial effects (FSEs) in each simulation. Default is 0.05. Max positive effect size is always 4, i.e., a 4x change in rate. There is no max to the min effect size, i.e., an effect can drop the rate to zero.
- modeling_functions
A named list of modeling functions to benchmark. Each function should take at least the arguments
sim(the simulation object produced byattractor_simulation) andsim_num(the simulation number). Default is a list containing only themodel_attractor_simulation_wispfunction. Functions provided in this list should return a dataframe with columnsest,true,param,id,method, andsim. Thetruecolumn should contain, for each simulation and each applicable parameter, the ground-truth value returned by theattractor_simulation_ground_truthfunction. Theestcolumn should contain the corresponding estimated value from the modeling function. Theparamcolumn should contain the name of the parameter (one of "rate_effect", "random_effect", "FSE", or "SVG"). Theidcolumn should contain the name of the gene or replicate associated with the parameter. Themethodcolumn should contain the name of the modeling method used. Thesimcolumn should contain the simulation number.- modeling_function_args
A named list of lists, where each sub-list contains additional arguments to pass to the corresponding modeling function in
modeling_functions. Default is a list containing arguments for themodel_attractor_simulation_wispfunction.