Assessment of absolute bias in posterior means and medians for a given weight and evidence level, using simulated data as input.
Usage
oc_bias(
m,
se,
true_effect,
weights = seq(0, 1, by = 0.01),
map_prior,
sigma,
n_cores = 1,
eval_strategy = "sequential"
)
Arguments
- m
Numerical vector of simulated effect estimates.
- se
Numerical vector of simulated standard errors (
m
andse
need to have the same length).- true_effect
Numerical value, representing the true treatment effect (usually the mean of the simulated
m
).- weights
Vector of weights of the informative component of the MAP prior (defaults to
seq(0, 1, by = 0.01)
).- map_prior
A MAP prior containing information about the trials in the source population, created using
RBesT
; a mixture of normal distributions is required.- sigma
Standard deviation of the weakly informative component of the MAP prior, recommended to be the unit-information standard deviation.
- n_cores
Integer value, representing the number of cores to be used (defaults to 1); only applies if
eval_strategy
is not "sequential".- eval_strategy
Character variable, representing the evaluation strategy, either "sequential", "multisession", or "multicore" (see documentation of
future::plan
, defaults to "sequential").
Examples
set.seed(123)
n_sims <- 5 # small number for exemplary application
sim_dat <- list(
"m" = rnorm(n = n_sims, mean = 1.15, sd = 0.1),
"se" = rnorm(n = n_sims, mean = 1.8, sd = 0.3)
)
results <- oc_bias(
m = sim_dat[["m"]],
se = sim_dat[["se"]],
true_effect = 1.15,
weights = seq(0, 1, by = 0.01),
map_prior = load_tipmap_data("tipmapPrior.rds"),
sigma = 16.23,
eval_strategy = "sequential",
n_cores = 1
)
#> Warning: Quantile 0.5 possibly imprecise.
#> Estimated precision= 4.31380082183221.
#> Range = -3.202666058438 to 5.42493558522642
print(results)
#> oc_types
#> weights abs.bias.post.mean abs.bias.post.median
#> w=0 0.005204572 0.005204572
#> w=0.01 0.031506884 0.079015454
#> w=0.02 0.054389411 0.129263624
#> w=0.03 0.074489107 0.164911837
#> w=0.04 0.092291912 0.191278086
#> w=0.05 0.108175481 0.211500574
#> w=0.06 0.122438058 0.227468756
#> w=0.07 0.135318499 0.240388033
#> w=0.08 0.147010480 0.251038838
#> w=0.09 0.157672788 0.259987130
#> w=0.1 0.167436895 0.267602623
#> w=0.11 0.176412633 0.274162009
#> w=0.12 0.184692500 0.279870511
#> w=0.13 0.192354971 0.284883488
#> w=0.14 0.199467074 0.289320685
#> w=0.15 0.206086416 0.293275866
#> w=0.16 0.212262792 0.296835702
#> w=0.17 0.218039468 0.300035662
#> w=0.18 0.223454229 0.302936660
#> w=0.19 0.228540217 0.305578716
#> w=0.2 0.233326632 0.308000700
#> w=0.21 0.237839299 0.310210655
#> w=0.22 0.242101147 0.312257002
#> w=0.23 0.246132603 0.314145972
#> w=0.24 0.249951928 0.315893972
#> w=0.25 0.253575494 0.317522267
#> w=0.26 0.257018028 0.319054625
#> w=0.27 0.260292807 0.320472195
#> w=0.28 0.263411842 0.321794948
#> w=0.29 0.266386015 0.323043331
#> w=0.3 0.269225220 0.324217332
#> w=0.31 0.271938464 0.325319098
#> w=0.32 0.274533969 0.326360940
#> w=0.33 0.277019256 0.327345640
#> w=0.34 0.279401215 0.328277780
#> w=0.35 0.281686175 0.329161462
#> w=0.36 0.283879954 0.330000375
#> w=0.37 0.285987916 0.330797841
#> w=0.38 0.288015010 0.331556860
#> w=0.39 0.289965811 0.332280151
#> w=0.4 0.291844555 0.332970181
#> w=0.41 0.293655169 0.333629196
#> w=0.42 0.295401299 0.334259243
#> w=0.43 0.297086336 0.334862193
#> w=0.44 0.298713437 0.335439760
#> w=0.45 0.300285543 0.335993516
#> w=0.46 0.301805401 0.336524904
#> w=0.47 0.303275577 0.337035255
#> w=0.48 0.304698471 0.337525795
#> w=0.49 0.306076332 0.337997656
#> w=0.5 0.307411266 0.338451888
#> w=0.51 0.308705252 0.338889460
#> w=0.52 0.309960148 0.339311275
#> w=0.53 0.311177700 0.339718168
#> w=0.54 0.312359554 0.340110918
#> w=0.55 0.313507259 0.340490252
#> w=0.56 0.314622275 0.340856846
#> w=0.57 0.315705981 0.341211331
#> w=0.58 0.316759678 0.341554299
#> w=0.59 0.317784598 0.341886302
#> w=0.6 0.318781905 0.342207858
#> w=0.61 0.319752701 0.342519453
#> w=0.62 0.320698030 0.342821543
#> w=0.63 0.321618883 0.343114558
#> w=0.64 0.322516198 0.343398900
#> w=0.65 0.323390867 0.343674949
#> w=0.66 0.324243739 0.343943063
#> w=0.67 0.325075617 0.344203580
#> w=0.68 0.325887270 0.344456818
#> w=0.69 0.326679426 0.344703078
#> w=0.7 0.327452779 0.344942645
#> w=0.71 0.328207993 0.345175789
#> w=0.72 0.328945698 0.345402764
#> w=0.73 0.329666496 0.345623813
#> w=0.74 0.330370963 0.345839164
#> w=0.75 0.331059648 0.346049036
#> w=0.76 0.331733076 0.346241427
#> w=0.77 0.332391748 0.346440949
#> w=0.78 0.333036145 0.346635581
#> w=0.79 0.333666725 0.346825500
#> w=0.8 0.334283930 0.347010877
#> w=0.81 0.334888180 0.347191872
#> w=0.82 0.335479879 0.347368639
#> w=0.83 0.336059415 0.347541324
#> w=0.84 0.336627158 0.347710067
#> w=0.85 0.337183466 0.347875002
#> w=0.86 0.337728681 0.348036257
#> w=0.87 0.338263131 0.348193952
#> w=0.88 0.338787132 0.348348205
#> w=0.89 0.339300988 0.348499128
#> w=0.9 0.339804991 0.348646827
#> w=0.91 0.340299421 0.348791404
#> w=0.92 0.340784550 0.348932958
#> w=0.93 0.341260637 0.349071581
#> w=0.94 0.341727932 0.349207366
#> w=0.95 0.342186678 0.349340397
#> w=0.96 0.342637106 0.349470757
#> w=0.97 0.343079441 0.349598527
#> w=0.98 0.343513900 0.349723783
#> w=0.99 0.343940690 0.349846598
#> w=1 0.344360014 0.349966990