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

bcoefficients unpacked generically

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