Skip to content
Snippets Groups Projects
Commit 192cf764 authored by dj44vuri's avatar dj44vuri
Browse files

now example really working

parent 97799e9c
No related branches found
No related tags found
No related merge requests found
...@@ -46,33 +46,40 @@ remotes::install_gitlab(repo = "dj44vuri/simulateDCE" , host = "https://git.idiv ...@@ -46,33 +46,40 @@ remotes::install_gitlab(repo = "dj44vuri/simulateDCE" , host = "https://git.idiv
This is a basic example for a simulation: This is a basic example for a simulation:
```{r example} ```{r example}
library(simulateDCE)
rm(list=ls())
library(simulateDCE)
library(rlang) library(rlang)
library(formula.tools) library(formula.tools)
# Designpath indicates the folder where all designs that should be simulated are stored. Can be either ngd files (for NGENE) or R objects for spdesign)
library(rlang)
designpath<- system.file("extdata","SE_DRIVE" ,package = "simulateDCE") designpath<- system.file("extdata","SE_DRIVE" ,package = "simulateDCE")
# on your computer, it would be something like resps =120 # number of respondents
# designpath <- "c:/myfancyDCE/Designs" nosim= 2 # number of simulations to run (about 500 is minimum)
# number of respondents
resps =120
# number of simulations to run (about 200 is minimum if you want to be serious -- but it takes some time. always test your code with 2 simulations, and if it runs smoothly, go for more.)
nosim= 2
# If you want to use different groups of respondents, use this. The following line means that you have one group of 70% size and one group of 30% size
# bpreis = -0.036
# blade = -0.034
# bwarte = -0.049
decisiongroups=c(0,0.7,1) decisiongroups=c(0,0.7,1)
# set the values of the parameters you want to use in the simulation # wrong parameters
#
bpreis = -0.01 bpreis = -0.01
blade = -0.07 blade = -0.07
bwarte = 0.02 bwarte = 0.02
# If you want to do some manipulations in the design before you simulate, add a list called manipulations. Here, we devide some attributes by 10
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),
alt2.x2= expr(alt2.x2/10), alt2.x2= expr(alt2.x2/10),
...@@ -80,8 +87,8 @@ manipulations = list(alt1.x2= expr(alt1.x2/10), ...@@ -80,8 +87,8 @@ manipulations = list(alt1.x2= expr(alt1.x2/10),
) )
#place your utility functions here. We have two utility functions and two sets of utility functions. This is because we assume that 70% act according to the utility u1 and 30% act to the utility u2 (that is, they only decide according to the price and ignore the other attributes) #place your utility functions here
u<-list( u1 = ul<-list( u1 =
list( list(
v1 =V.1~ bpreis * alt1.x1 + blade*alt1.x2 + bwarte*alt1.x3 , v1 =V.1~ bpreis * alt1.x1 + blade*alt1.x2 + bwarte*alt1.x3 ,
...@@ -94,11 +101,11 @@ u<-list( u1 = ...@@ -94,11 +101,11 @@ u<-list( u1 =
) )
# specify the designtype "ngene" or "spdesign"
destype="ngene" destype="ngene"
sedrive <- sim_all(nosim = nosim, resps=resps, destype = destype,
designpath = designpath, u=ul)
#lets go
sedrive <- sim_all()
``` ```
This diff is collapsed.
man/figures/README-example-1.png

53.3 KiB | W: | H:

man/figures/README-example-1.png

39.7 KiB | W: | H:

man/figures/README-example-1.png
man/figures/README-example-1.png
man/figures/README-example-1.png
man/figures/README-example-1.png
  • 2-up
  • Swipe
  • Onion skin
man/figures/README-example-2.png

46.3 KiB | W: | H:

man/figures/README-example-2.png

46.5 KiB | W: | H:

man/figures/README-example-2.png
man/figures/README-example-2.png
man/figures/README-example-2.png
man/figures/README-example-2.png
  • 2-up
  • Swipe
  • Onion skin
man/figures/README-example-3.png

52.8 KiB | W: | H:

man/figures/README-example-3.png

42.3 KiB | W: | H:

man/figures/README-example-3.png
man/figures/README-example-3.png
man/figures/README-example-3.png
man/figures/README-example-3.png
  • 2-up
  • Swipe
  • Onion skin
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment