Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dce_simulation_tool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dj44vuri
dce_simulation_tool
Commits
3eecbb81
Commit
3eecbb81
authored
1 year ago
by
dj44vuri
Browse files
Options
Downloads
Patches
Plain Diff
working again after errors
parent
bdb9338e
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Projects/ValuGaps/parameters_valugaps.R
+1
-4
1 addition, 4 deletions
Projects/ValuGaps/parameters_valugaps.R
functions.R
+2
-7
2 additions, 7 deletions
functions.R
simulationcore_purrr.R
+1
-1
1 addition, 1 deletion
simulationcore_purrr.R
with
4 additions
and
12 deletions
Projects/ValuGaps/parameters_valugaps.R
+
1
−
4
View file @
3eecbb81
...
@@ -118,10 +118,7 @@ u<-list(
...
@@ -118,10 +118,7 @@ u<-list(
v2
=
V.2
~
basc
+
bb
*
alt2.protected
+
bb2
*
alt2.protectedsq
+
bc
*
alt2.HNV
+
bc2
*
alt2.HNVsq
+
bp
*
alt2.p
,
v2
=
V.2
~
basc
+
bb
*
alt2.protected
+
bb2
*
alt2.protectedsq
+
bc
*
alt2.HNV
+
bc2
*
alt2.HNVsq
+
bp
*
alt2.p
,
v3
=
V.3
~
bb
*
alt3.protected
+
bb2
*
alt3.protectedsq
+
bc
*
alt3.HNV
+
bc2
*
alt3.HNVsq
)
v3
=
V.3
~
bb
*
alt3.protected
+
bb2
*
alt3.protectedsq
+
bc
*
alt3.HNV
+
bc2
*
alt3.HNVsq
)
# u<-list(
# v1 =V.1~ basc + bb*alt1.b+ bc * alt1.c + bp * alt1.p ,
# v2 =V.2~ basc + bb*alt2.b+ bc * alt2.c + bp * alt2.p ,
# v3 =V.3~ 0)
## this function will be called before the data is simulated
## this function will be called before the data is simulated
...
...
This diff is collapsed.
Click to expand it.
functions.R
+
2
−
7
View file @
3eecbb81
...
@@ -42,7 +42,7 @@ sim_choice <- function(designfile, no_sim=10, respondents=330, mnl_U,utils=u ) {
...
@@ -42,7 +42,7 @@ sim_choice <- function(designfile, no_sim=10, respondents=330, mnl_U,utils=u ) {
simulate_choices
<-
function
(
data
=
datadet
)
{
#the part in dataset that needs to be repeated in each run
simulate_choices
<-
function
(
data
=
datadet
)
{
#the part in dataset that needs to be repeated in each run
cat
(
"does sou_gis exist"
)
cat
(
"does sou_gis exist
:
"
)
print
(
exists
(
"sou_gis"
))
print
(
exists
(
"sou_gis"
))
# browser()
# browser()
...
@@ -60,22 +60,17 @@ cat("does sou_gis exist")
...
@@ -60,22 +60,17 @@ cat("does sou_gis exist")
print
(
"DANGER"
)
print
(
exists
(
"final_set"
))
print
(
exists
(
"final_set"
))
if
(
exists
(
"final_set"
))
data
=
left_join
(
data
,
final_set
,
by
=
"ID"
)
if
(
exists
(
"final_set"
))
data
=
left_join
(
data
,
final_set
,
by
=
"ID"
)
data
<-
data
%>%
data
<-
data
%>%
# rename(ID="RID") %>%
group_by
(
ID
)
%>%
group_by
(
ID
)
%>%
#rename(ID ="RID") %>%
#rename_with(~ stringr::str_replace(.,pattern = "\\.","_"), everything()) %>%
mutate
(
!!!
manipulations
,
mutate
(
!!!
manipulations
,
map_dfc
(
utils
,
by_formula
))
%>%
#our functions to create utility variables. They need to be entered as a formula list as an argument
map_dfc
(
utils
,
by_formula
))
%>%
#our functions to create utility variables. They need to be entered as a formula list as an argument
rename_with
(
~
stringr
::
str_replace
(
.
,
pattern
=
"\\."
,
"_"
),
everything
())
%>%
rename_with
(
~
stringr
::
str_replace
(
.
,
pattern
=
"\\."
,
"_"
),
everything
())
%>%
mutate
(
across
(
.cols
=
n
,
.fns
=
~
rgumbel
(
setpp
,
loc
=
0
,
scale
=
1
),
.names
=
"{'e'}_{n}"
),
mutate
(
across
(
.cols
=
n
,
.fns
=
~
rgumbel
(
setpp
,
loc
=
0
,
scale
=
1
),
.names
=
"{'e'}_{n}"
),
across
(
starts_with
(
"V_"
),
.names
=
"{'U'}_{n}"
)
+
across
(
starts_with
(
"e_"
))
)
%>%
ungroup
()
%>%
across
(
starts_with
(
"V_"
),
.names
=
"{'U'}_{n}"
)
+
across
(
starts_with
(
"e_"
))
)
%>%
ungroup
()
%>%
mutate
(
CHOICE
=
max.col
(
.
[,
grep
(
"U_"
,
names
(
.
))])
mutate
(
CHOICE
=
max.col
(
.
[,
grep
(
"U_"
,
names
(
.
))])
...
...
This diff is collapsed.
Click to expand it.
simulationcore_purrr.R
+
1
−
1
View file @
3eecbb81
...
@@ -15,7 +15,7 @@ source(params$file)
...
@@ -15,7 +15,7 @@ source(params$file)
designfile
<-
list.files
(
designpath
,
full.names
=
T
)
designfile
<-
list.files
(
designpath
,
full.names
=
T
)
designname
<-
str_remove_all
(
list.files
(
designpath
,
full.names
=
F
),
designname
<-
str_remove_all
(
list.files
(
designpath
,
full.names
=
F
),
"(.ngd|_)"
)
## Make sure
it
designnames to not contain file ending and "_", as the may cause issues when replace
"(.ngd|_)"
)
## Make sure designnames to not contain file ending and "_", as the may cause issues when replace
#plan(multisession, workers = 8)
#plan(multisession, workers = 8)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment