diff --git a/DESCRIPTION b/DESCRIPTION index 260f9bd8ac5636c1efd615a0a68f76af05fca3db..470a1e7fa37fe1189482f17c9bf2e513de591252 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -8,7 +8,7 @@ Description: A package that supports simulating choice experiment data for given License: MIT + file LICENSE Encoding: UTF-8 Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.0 +RoxygenNote: 7.3.1 Imports: dplyr (>= 1.1.4), evd, diff --git a/R/simulate_choices.R b/R/simulate_choices.R index 92cb295a8cd4a440ee7c3e93902daa4de4f06b54..8b7c75b6e8607bec46001ecbb4069be295f05213 100644 --- a/R/simulate_choices.R +++ b/R/simulate_choices.R @@ -9,7 +9,8 @@ #' #' @examples \dontrun{simulate_choices(datadet, ut,setspp)} simulate_choices <- function(data, utility, setspp, destype, bcoefficients) { #the part in dataset that needs to be repeated in each run - ### unpack the bcoeff list + +### unpack the bcoeff list bsq <- bcoefficients$bsq bredkite <- bcoefficients$bredkite bdistance <- bcoefficients$bdistance diff --git a/man/sim_all.Rd b/man/sim_all.Rd index 6d276604f028470e249900cb0f9e8510f774b820..fb98d8e2640c9e694c22da328431668f2119ed27 100644 --- a/man/sim_all.Rd +++ b/man/sim_all.Rd @@ -4,7 +4,7 @@ \alias{sim_all} \title{Is a wrapper for sim_choice executing the simulation over all designs stored in a specific folder} \usage{ -sim_all(nosim = 2, resps, destype = "ngene", designpath, u) +sim_all(nosim = 2, resps, destype = "ngene", designpath, u, bcoeff) } \arguments{ \item{nosim}{Number of runs or simulations. For testing use 2 but once you go serious, use at least 200, for better results use 2000.} @@ -16,6 +16,8 @@ sim_all(nosim = 2, resps, destype = "ngene", designpath, u) \item{designpath}{The path to the folder where the designs are stored. For example "c:/myfancydec/Designs"} \item{u}{A list with utility functions. The list can incorporate as many decision rule groups as you want. However, each group must be in a list in this list. If you just use one group (the normal), this group still has to be in a list in the u list.} + +\item{bcoefficients}{List of coefficients for the utility function. List content/length can vary based on application, but item names should be in namespace: {bsq, bredkite, bdistance, bcost, bfarm2, bfarm3, bheight2, bheight3}} } \value{ A list, with all information on the simulation. This list an be easily processed by the user and in the rmarkdown template. @@ -29,4 +31,13 @@ Is a wrapper for sim_choice executing the simulation over all designs stored in resps =240 # number of respondents nosim=2 # number of simulations to run (about 500 is minimum) + bcoeff <-list(bsq=0.00, # hypothesized beta coefficients for individual terms of the utility function + bredkite=-0.05, + bdistance=0.50, + bcost=-0.05, + bfarm2=0.25, + bfarm3=0.50, + bheight2=0.25, + bheight3=0.50) + } diff --git a/man/sim_choice.Rd b/man/sim_choice.Rd index 8f40c9644dbb09820fdbd4a9bd7ec525d612dc08..1b6ecbcf5d37b30e4016e8c1e7e2b0076f86da97 100644 --- a/man/sim_choice.Rd +++ b/man/sim_choice.Rd @@ -4,7 +4,14 @@ \alias{sim_choice} \title{Title} \usage{ -sim_choice(designfile, no_sim = 10, respondents = 330, ut, destype = destype) +sim_choice( + designfile, + no_sim = 10, + respondents = 330, + ut, + destype = destype, + bcoefficients +) } \arguments{ \item{designfile}{path to a file containing a design.} diff --git a/man/simulate_choices.Rd b/man/simulate_choices.Rd index 3a3f85f27f0504e0742ee6c439ceb1d6f6071fc5..17e91e638bbd0d839b21fe6db696bb9b4269975f 100644 --- a/man/simulate_choices.Rd +++ b/man/simulate_choices.Rd @@ -4,7 +4,7 @@ \alias{simulate_choices} \title{Simulate choices based on a dataframe with a design} \usage{ -simulate_choices(data, utility, setspp, destype) +simulate_choices(data, utility, setspp, destype, bcoefficients) } \arguments{ \item{data}{a dataframe that includes a design repeated for the number of observations}