From b0fb0da5e7a4d6797a96f93a3ef8f9b2918eb25f Mon Sep 17 00:00:00 2001
From: Julian Sagebiel <julian.sagebiel@idiv.de>
Date: Wed, 26 Jun 2024 22:08:15 +0200
Subject: [PATCH] minor changes

---
 R/sim_all.R             | 6 +++++-
 R/sim_choice.R          | 4 ++--
 R/simulate_choices.R    | 2 +-
 man/sim_choice.Rd       | 2 +-
 man/simulate_choices.Rd | 3 ++-
 5 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/R/sim_all.R b/R/sim_all.R
index e38cf7c..495ea14 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 45cd91f..cc761ae 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 3ccdaf2..2fc9a09 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 5dbfddc..21c3183 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 db94ad0..e23bb26 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{
-- 
GitLab