Skip to content

Commit

Permalink
adding jitter to mapped parameters to make them different
Browse files Browse the repository at this point in the history
  • Loading branch information
nielshintzen committed Apr 11, 2024
1 parent 2af888d commit 81f96be
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions R/FLSAM.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,11 @@ FLSAM <-function(stcks,tun,ctrl,catch.vars=NULL,return.fit=F,starting.values=NUL


mapDef <- as.list(matchNames[,"SAM"]); names(mapDef) <- matchNames[,"SAM"]
for(i in names(mapDef))
mapDef[[i]] <- parS[[i]]
for(i in names(mapDef)){
mapDef[[i]] <- jitter(parS[[i]],factor=0.1)
if(any(duplicated(mapDef[[i]])))
stop("mapping goes wrong, some parameters get the same starting value, retry")
}
map <- mapDef

for(i in 1:nrow(set.pars)){
Expand All @@ -64,6 +67,7 @@ FLSAM <-function(stcks,tun,ctrl,catch.vars=NULL,return.fit=F,starting.values=NUL
logQpow=as.factor(map$logQpow),
logSdLogFsta=as.factor(map$logSdLogFsta),
logSdLogObs=as.factor(map$logSdLogObs))

map <- map[which(names(map) %in% set.pars$SAM)]
fit <- sam.fit(dataS,confS,parS,map=map,sim.condRE=ctrl@simulate,...)
} else {
Expand Down

0 comments on commit 81f96be

Please sign in to comment.