Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CHIN_sim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Margarete Walden
CHIN_sim
Commits
fca5563e
Commit
fca5563e
authored
10 months ago
by
Margarete Walden
Browse files
Options
Downloads
Patches
Plain Diff
Replace sim_variables.R
parent
2a890431
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/sim_variables.R
+74
-74
74 additions, 74 deletions
scripts/sim_variables.R
with
74 additions
and
74 deletions
scripts/sim_variables.R
+
74
−
74
View file @
fca5563e
####
####----1. ABOUT------------------------------------------------------------####
####
#### Evaluating alternative methods for modeling trap
#### efficiencies of outmigrating juvenile salmonids
####
#### Authors: Walden et al.
####
#### Content: R-Code for sourcing declared variables.
####
#### This is the file for Supplement X of the manuscript.
####
####----2. "True" parameter values for simulated data-----------------------####
## Covariates
Qmin
<-
500
# discharge
Qmax
<-
7000
# discharge
degCmin
<-
6
# temperature
degCmax
<-
21
# temperature
effortmin
<-
720
# effort
effortmax
<-
3840
# effort
precipitation
<-
0
# precipitation (yes/no) (nuisance)
nyear
<-
10
# groups (random effects)
## Set parameter values
Beta0_maxpt1
<-
-3.2
# Trap efficiency max 0.10
Beta0_maxpt25
<-
-2.1
# Trap efficiency max 0.25
Beta1
<-
-0.3
# discharge
Beta2
<-
0.2
# temperature
Beta3
<-
0.2
# effort
Beta4
<-
0.0
# precipitation yes/no
Beta5
<-
-0.4
# effort^2
Beta6
<-
0.4
# discharge x temperature interaction
raneffSD
<-
0.1
# year effect standard deviation
phiTrue
<-
0.0002
####----3. Simulation variables---------------------------------------------####
# vector of sample sizes to test
nset
<-
c
(
50
,
100
,
150
,
200
)
# vector of trap efficiencies to test
theseefficiencies
<-
c
(
"Max efficiency 0.1"
,
"Max efficiency 0.25"
)
# Number of simulations to complete
nsim
<-
1000
# number of MCMC samples to extract for marginal predictions
nsample
<-
1000
# size of test dataset
ntest
<-
100
####----4. Model parameters, hyperparameters, or variables------------------####
## For boosted regression modeling
seed.cvrisk
<-
143180916
mutuneiter
<-
2000
phituneiter
<-
2000
nu_hp
=
0.1
fmu
<-
as.formula
(
y
~
1
+
bols
(
discharge
,
intercept
=
FALSE
)
+
bols
(
temperature
,
intercept
=
FALSE
)
+
bols
(
effort
,
intercept
=
FALSE
)
+
bols
(
precip
,
intercept
=
FALSE
)
+
bbs
(
effort
,
knots
=
2
,
boundary.knots
=
NULL
,
degree
=
2
,
df
=
1
,
center
=
TRUE
)
+
bols
(
temperature
,
intercept
=
FALSE
,
df
=
1
)
%X%
bols
(
discharge
,
intercept
=
FALSE
,
df
=
1
)
+
brandom
(
year
)
)
fphi
<-
as.formula
(
y
~
1
)
nboot
<-
1000
kfoldB
<-
25
## For random forest modeling
seed.forest
<-
234672817
####
####----1. ABOUT------------------------------------------------------------####
####
#### Evaluating alternative methods for modeling trap
#### efficiencies of outmigrating juvenile salmonids
####
#### Authors: Walden et al.
####
#### Content: R-Code for sourcing declared variables.
####
#### This is the file for Supplement X of the manuscript.
####
####----2. "True" parameter values for simulated data-----------------------####
## Covariates
Qmin
<-
500
# discharge
Qmax
<-
7000
# discharge
degCmin
<-
6
# temperature
degCmax
<-
21
# temperature
effortmin
<-
720
# effort
effortmax
<-
3840
# effort
precipitation
<-
0
# precipitation (yes/no) (nuisance)
nyear
<-
10
# groups (random effects)
## Set parameter values
Beta0_maxpt1
<-
-3.2
# Trap efficiency max 0.10
Beta0_maxpt25
<-
-2.1
# Trap efficiency max 0.25
Beta1
<-
-0.3
# discharge
Beta2
<-
0.2
# temperature
Beta3
<-
0.2
# effort
Beta4
<-
0.0
# precipitation yes/no
Beta5
<-
-0.4
# effort^2
Beta6
<-
0.4
# discharge x temperature interaction
raneffSD
<-
0.1
# year effect standard deviation
phiTrue
<-
0.0002
####----3. Simulation variables---------------------------------------------####
# vector of sample sizes to test
nset
<-
c
(
50
,
100
,
150
,
200
)
# vector of trap efficiencies to test
theseefficiencies
<-
c
(
"Max efficiency 0.1"
,
"Max efficiency 0.25"
)
# Number of simulations to complete
nsim
<-
1000
# number of MCMC samples to extract for marginal predictions
nsample
<-
1000
# size of test dataset
ntest
<-
100
####----4. Model parameters, hyperparameters, or variables------------------####
## For boosted regression modeling
seed.cvrisk
<-
143180916
mutuneiter
<-
2000
phituneiter
<-
2000
nu_hp
=
0.1
fmu
<-
as.formula
(
y
~
1
+
bols
(
discharge
,
intercept
=
FALSE
)
+
bols
(
temperature
,
intercept
=
FALSE
)
+
bols
(
effort
,
intercept
=
FALSE
)
+
bols
(
precip
,
intercept
=
FALSE
)
+
bbs
(
effort
,
knots
=
2
,
boundary.knots
=
NULL
,
degree
=
2
,
df
=
1
,
center
=
TRUE
)
+
bols
(
temperature
,
intercept
=
FALSE
,
df
=
1
)
%X%
bols
(
discharge
,
intercept
=
FALSE
,
df
=
1
)
+
brandom
(
year
)
)
fphi
<-
as.formula
(
y
~
1
)
nboot
<-
1000
kfoldB
<-
25
## For random forest modeling
seed.forest
<-
234672817
rftrees
<-
2000
\ No newline at end of file
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