params <- list(
param=list("a","b"),
dist=list("rlnorm","rnorm"),
n=list(4,1),
a=list(c(1,2,3,4),1),
b=list(c(0.5,0.5,0.5,0.5),0.5),
dsa_min=list(c(1,2,3,4),2),
dsa_max=list(c(1,2,3,4),3)
)
pick_psa(params[["dist"]],params[["n"]],params[["a"]],params[["b"]])
#It works with functions that require different number of parameters
params <- list(
param=list("a","b","c"),
dist=list("rlnorm","rnorm","rgengamma"),
n=list(4,1,1),
a=list(c(1,2,3,4),1,0),
b=list(c(0.5,0.5,0.5,0.5),0.5,1),
c=list(NA,NA,0.2),
dsa_min=list(c(1,2,3,4),2,1),
dsa_max=list(c(1,2,3,4),3,3)
)
pick_psa(params[["dist"]],params[["n"]],params[["a"]],params[["b"]],params[["c"]])
#Can be combined with multiple type of functions and distributions if parameters are well located
params <- list(
param=list("a","b","c","d"),
dist=list("rlnorm","rnorm","rgengamma","draw_tte"),
n=list(4,1,1,1),
a=list(c(1,2,3,4),1,0,"norm"),
b=list(c(0.5,0.5,0.5,0.5),0.5,1,1),
c=list(NA,NA,0.2,0.5),
c=list(NA,NA,NA,NA), #NA arguments will be ignored
dsa_min=list(c(1,2,3,4),2,1,0),
dsa_max=list(c(1,2,3,4),3,3,2)
)
Run the code above in your browser using DataLab