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

agora test added initial vignette trial structure built

parent e51dbdde
No related branches found
No related tags found
No related merge requests found
.Rproj.user
.Rhistory
inst/doc
......@@ -26,7 +26,9 @@ Imports:
tictoc,
tidyr
Suggests:
knitr,
testthat (>= 3.0.0)
Config/testthat/edition: 3
Depends:
R (>= 3.6.0)
VignetteBuilder: knitr
......@@ -14,14 +14,15 @@ resps =240 # 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,
bdistance=0.50,
bcost=-0.05,
bfarm2=0.25,
bfarm3=0.50,
bheight2=0.25,
bheight3=0.50)
destype <- "spdesign"
......@@ -38,7 +39,7 @@ ul<- list(u1= list(
rbook <- simulateDCE::sim_all(nosim = nosim, resps=resps, destype = destype,
designpath = designpath, u= ul)
designpath = designpath, u= ul, bcoeff = bcoeff)
......@@ -52,14 +52,3 @@ destype="ngene"
sedrive <- sim_all(nosim = nosim, resps=resps, destype = destype,
designpath = designpath, u=ul, bcoeff = bcoeff)
## nested results are hard coded, if the design changes this must aswell
coeffNestedOutput <- sedrive$olddesign$coefs
variable_names <- names(coeffNestedOutput)
# Filter variable names that start with "est_"
est_variables <- grep("^est_", variable_names, value = TRUE)
print('hello')
print(class(coeffNestedOutput))
designpath<- system.file("extdata","agora" ,package = "simulateDCE")
resps =360 # number of respondents
nosim=2 # number of simulations to run (about 500 is minimum)
#betacoefficients should not include "-"
#design priors parameters
bcoeff <- list(
basc = -1.2,
basc2 = -1.4,
baction = 0.1,
badvisory = 0.4,
bpartner = 0.3,
bcomp = 0.02)
# from survey
# basc = -2.2
# basc2 = -2.7
# baction = -0.15
# badvisory = 0.26
# bpartner = -0.09
# bcomp = 0.004
#place your utility functions here
ul<-list( u1 =
list(
v1=V.1 ~ basc + baction*alt1.b + badvisory * alt1.c + bpartner * alt1.d + bcomp * alt1.p , #Utility of alternative 1
v2=V.2 ~ basc2 + baction*alt2.b + badvisory * alt2.c + bpartner * alt2.d + bcomp * alt2.p , #Utility of alternative 2
v3=V.3 ~ 0)
)
destype="ngene"
agora <- sim_all(nosim = nosim, resps=resps, destype = destype,
designpath = designpath, u=ul, bcoeff = bcoeff)
*.html
*.R
---
title: "vignette_SE_Drive"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{vignette_SE_Drive}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
```{r setup}
library(simulateDCE)
```
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