From 8787d92d580dea37b85616fe40be75be5527f737 Mon Sep 17 00:00:00 2001 From: dj44vuri <julian.sagebiel@idiv.de> Date: Wed, 7 Feb 2024 11:37:53 +0100 Subject: [PATCH] small changes in manual --- DESCRIPTION | 2 +- R/simulate_choices.R | 3 ++- man/sim_all.Rd | 13 ++++++++++++- man/sim_choice.Rd | 9 ++++++++- man/simulate_choices.Rd | 2 +- 5 files changed, 24 insertions(+), 5 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 260f9bd..470a1e7 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 92cb295..8b7c75b 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 6d27660..fb98d8e 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 8f40c96..1b6ecbc 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 3a3f85f..17e91e6 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} -- GitLab