Skip to content
Snippets Groups Projects
Commit c8d3d26f authored by samuelsmock's avatar samuelsmock
Browse files

bcoefficients unpacked generically

parent b0f08630
Branches
Tags
No related merge requests found
...@@ -9,15 +9,10 @@ ...@@ -9,15 +9,10 @@
#' #'
#' @examples \dontrun{simulate_choices(datadet, ut,setspp)} #' @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 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 so variables are accessible
bsq <- bcoefficients$bsq for (key in names(bcoefficients)) {
bredkite <- bcoefficients$bredkite assign(key, bcoefficients[[key]])
bdistance <- bcoefficients$bdistance }
bcost <- bcoefficients$bcost
bfarm2 <- bcoefficients$bfarm2
bfarm3 <- bcoefficients$bfarm3
bheight2 <- bcoefficients$bheight2
bheight3 <- bcoefficients$bheight3
......
...@@ -11,11 +11,6 @@ designpath<- system.file("extdata","SE_DRIVE" ,package = "simulateDCE") ...@@ -11,11 +11,6 @@ designpath<- system.file("extdata","SE_DRIVE" ,package = "simulateDCE")
resps =120 # number of respondents resps =120 # number of respondents
nosim= 2 # number of simulations to run (about 500 is minimum) nosim= 2 # number of simulations to run (about 500 is minimum)
# bpreis = -0.036 # bpreis = -0.036
# blade = -0.034 # blade = -0.034
# bwarte = -0.049 # bwarte = -0.049
...@@ -25,10 +20,11 @@ decisiongroups=c(0,0.7,1) ...@@ -25,10 +20,11 @@ decisiongroups=c(0,0.7,1)
# wrong parameters # wrong parameters
# # pass beta coefficients as a list
bpreis = -0.01 bcoeff <- list(
blade = -0.07 bpreis = -0.01,
bwarte = 0.02 blade = -0.07,
bwarte = 0.02)
manipulations = list(alt1.x2= expr(alt1.x2/10), manipulations = list(alt1.x2= expr(alt1.x2/10),
alt1.x3= expr(alt1.x3/10), alt1.x3= expr(alt1.x3/10),
...@@ -55,4 +51,4 @@ ul<-list( u1 = ...@@ -55,4 +51,4 @@ ul<-list( u1 =
destype="ngene" destype="ngene"
sedrive <- sim_all(nosim = nosim, resps=resps, destype = destype, sedrive <- sim_all(nosim = nosim, resps=resps, destype = destype,
designpath = designpath, u=ul) designpath = designpath, u=ul, bcoeff = bcoeff)
No preview for this file type
...@@ -10,14 +10,6 @@ resps =40 # number of respondents ...@@ -10,14 +10,6 @@ resps =40 # number of respondents
nosim=2 # number of simulations to run (about 500 is minimum) nosim=2 # number of simulations to run (about 500 is minimum)
#betacoefficients should not include "-" #betacoefficients should not include "-"
bsq=0.00
bredkite=-0.05
bdistance=0.50
bcost=-0.05
bfarm2=0.25
bfarm3=0.50
bheight2=0.25
bheight3=0.50
bcoeff <-list(bsq=0.00, bcoeff <-list(bsq=0.00,
bredkite=-0.05, bredkite=-0.05,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment