diff --git a/R/sim_all.R b/R/sim_all.R index e38cf7c5512b433915b90ce5233286d0467f2705..495ea14a97f8e8530bd74de6682b6315b197b129 100644 --- a/R/sim_all.R +++ b/R/sim_all.R @@ -111,7 +111,7 @@ sim_all <- function(nosim=2, resps, destype=NULL, designpath, u, bcoeff, decisio tictoc::tic() all_designs<- purrr::map(designfile, sim_choice, - no_sim= nosim,respondents = resps, destype=destype, ut=u, bcoefficients = bcoeff, decisiongroups = decisiongroups, manipulations = manipulations) %>% ## iterate simulation over all designs + no_sim= nosim,respondents = resps, destype=destype, ut=u, bcoefficients = bcoeff, decisiongroups = decisiongroups, manipulations = manipulations, estimate = estimate) %>% ## iterate simulation over all designs stats::setNames(designname) @@ -119,6 +119,8 @@ sim_all <- function(nosim=2, resps, destype=NULL, designpath, u, bcoeff, decisio print(time) +if (estimate==TRUE) { + powa <- purrr::map(all_designs, ~ .x$power) @@ -155,6 +157,8 @@ sim_all <- function(nosim=2, resps, destype=NULL, designpath, u, bcoeff, decisio all_designs[["summaryall"]] = summaryall all_designs[["graphs"]]=p all_designs[["powa"]]=powa + +} all_designs[["time"]]=time all_designs[["arguements"]] = list( "Beta values" = bcoeff, "Utility functions" = u , "Decision groups" =decisiongroups , "Manipulation of vars" = manipulations, "Number Simulations" = nosim, "Respondents" = resps, "Designpath" = designpath) diff --git a/R/sim_choice.R b/R/sim_choice.R index 45cd91f9ed4b5555b65e9e6bcaa51b8341929f89..cc761aee9819b3848f9082e731542ed8602e8b15 100644 --- a/R/sim_choice.R +++ b/R/sim_choice.R @@ -13,7 +13,7 @@ #' @examples \dontrun{ simchoice(designfile="somefile", no_sim=10, respondents=330, #' mnl_U,ut=u[[1]] ,destype="ngene")} #' -sim_choice <- function(designfile, no_sim=10, respondents=330,ut ,destype=destype, bcoefficients, decisiongroups=c(0,1), manipulations = list() , estimate = TRUE) { +sim_choice <- function(designfile, no_sim=10, respondents=330,ut ,destype=destype, bcoefficients, decisiongroups=c(0,1), manipulations = list() , estimate) { @@ -95,7 +95,7 @@ designs_all <- list() ### start estimation - if (estimate==TRUE) { + if(estimate==TRUE) { diff --git a/R/simulate_choices.R b/R/simulate_choices.R index 3ccdaf29346cbbb82a38a4345a8afabf002bb6a1..2fc9a092c07a686e98fbc8ab5fcb96d9a259dcce 100644 --- a/R/simulate_choices.R +++ b/R/simulate_choices.R @@ -11,7 +11,7 @@ #' @export #' #' @examples \dontrun{simulate_choices(datadet, ut,setspp)} -simulate_choices <- function(data, utility, setspp, destype, bcoefficients, decisiongroups = c(0,1), manipulations = list()) { #the part in dataset that needs to be repeated in each run +simulate_choices <- function(data, utility, setspp, destype, bcoefficients, decisiongroups = c(0,1), manipulations = list(), estimate) { #the part in dataset that needs to be repeated in each run diff --git a/man/sim_choice.Rd b/man/sim_choice.Rd index 5dbfddcb825c74a0af917f58ccb0e03a94b884cc..21c3183a4222b8a1076d357391354547eb76ce83 100644 --- a/man/sim_choice.Rd +++ b/man/sim_choice.Rd @@ -13,7 +13,7 @@ sim_choice( bcoefficients, decisiongroups = c(0, 1), manipulations = list(), - estimate = TRUE + estimate ) } \arguments{ diff --git a/man/simulate_choices.Rd b/man/simulate_choices.Rd index db94ad023faaca4954ecd12acb75737db4a04bdf..e23bb261cb78528d670d3b91e0c896fc925a6774 100644 --- a/man/simulate_choices.Rd +++ b/man/simulate_choices.Rd @@ -11,7 +11,8 @@ simulate_choices( destype, bcoefficients, decisiongroups = c(0, 1), - manipulations = list() + manipulations = list(), + estimate ) } \arguments{