Skip to content

Commit

Permalink
pop & leslie
Browse files Browse the repository at this point in the history
  • Loading branch information
lauriekell committed Oct 14, 2023
1 parent 7261269 commit b63ba6b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions R/mseMPJabba.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ oemFn<-function(om,maxyear=max(dimnames(om)$year),devu=NULL){
transform(merge(ts,devu,all.x=T),cpue=cpue*exp(residual))[,-6]}


jabba2biodyn<-function(object, phase=c("b0"=-1,"r"=4,"k"=3,"p"=-2,"q"=2,"sigma"=1),
jb2bd<-function(object, phase=c("b0"=-1,"r"=4,"k"=3,"p"=-2,"q"=2,"sigma"=1),
min=0.1,max=10){

res=mpb:::biodyn()
Expand Down Expand Up @@ -138,7 +138,7 @@ mseMPJabba<-function(om,eq,sa,
nt =1,
nb =500,
nc =2)
mp=jabba2biodyn(jb)
mp=jb2bd(jb)
mp=window(mp,end=iYr)

## Update current year catch
Expand Down
12 changes: 6 additions & 6 deletions R/popdyn.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ utils::globalVariables(c("lhEql","lhPar","lopt","maply","lambda"))
#' popdyn(par)
#' }


.leslie=leslie
popdyn<-function(object,eq=lhEql(lhPar(object))){

par=lhPar(object)

rtn=par[c("linf","k","t0","a50","l50","ato95","a","b","s","v")]
Expand Down Expand Up @@ -56,7 +56,7 @@ popdyn<-function(object,eq=lhEql(lhPar(object))){
rtn=rbind(rtn,lc)

r=maply(seq(dims(eq)$iter), function(x)
log(lambda(leslie(iter(eq,x),fbar=c(refpts(eq)["crash","harvest",x]))[drop=TRUE])))
log(lambda(FLife:::leslie(iter(eq,x),fbar=c(refpts(eq)["crash","harvest",x]))[,,1,drop=TRUE])))
r=FLPar(r=array(c(r),c(1,length(c(r)))))
rtn=rbind(rtn,r)

Expand Down Expand Up @@ -120,14 +120,14 @@ popdyn<-function(object,eq=lhEql(lhPar(object))){
#LF=M
lfm=FLPar("lfm"=c(0.75*rtn["lc"]+0.25*rtn["linf"]))
rtn=rbind(rtn,lfm)

r=maply(seq(dims(eq)$iter), function(x)
log(lambda(leslie(iter(eq,x),fbar=c(refpts(eq)["crash","harvest",x]))[drop=TRUE])))
log(lambda(FLife:::leslie(iter(eq,x),fbar=c(refpts(eq)["crash","harvest",x]))[,,1,drop=TRUE])))
r=FLPar(r=array(c(r),c(1,length(c(r)))))
rtn=rbind(rtn,r)

rc=maply(seq(dims(eq)$iter), function(x)
log(lambda(leslie(iter(eq,x),fbar=c(refpts(eq)["msy","harvest",x]))[drop=TRUE])))
log(lambda(FLife:::leslie(iter(eq,x),fbar=c(refpts(eq)["msy","harvest",x]))[,,1,drop=TRUE])))
rc=FLPar(rc=array(c(rc),c(1,length(c(rc)))))
rtn=rbind(rtn,rc)

Expand Down

0 comments on commit b63ba6b

Please sign in to comment.