Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
bd2d832
Added qdev parameters
smartell Mar 29, 2015
2723e76
Implemented time-varying q with random walk parameters estimated, rev…
smartell Mar 30, 2015
54f27aa
q_dev parameters now estimable
smartell Mar 30, 2015
9cef226
Extended nlvec to accomodate process errors in catchability
smartell Mar 30, 2015
dad1c07
Time varying q, close #37
smartell Mar 30, 2015
5dd148f
Fixed array out of bounds error
smartell Mar 30, 2015
fffd56d
Control file change
smartell Mar 30, 2015
ad781e4
added compositionLikelihoods.hpp
smartell Mar 30, 2015
f262f63
Working on compositionLikelihoods.hpp
smartell Mar 30, 2015
4e0ef7a
Still working out methods for abstract base class
smartell Mar 30, 2015
a1113a8
Creating DATA and DVAR typenames for composition likelihoods
smartell Mar 31, 2015
72e61cd
Still developing negLogLikelihood abstract class
smartell Mar 31, 2015
6602b55
Fixed minor error in getRaggedVectors
smartell Apr 1, 2015
9fc0b02
More progress on the multivariateLogistic derived class
smartell Apr 1, 2015
c1843f3
More progress on the multivariateLogistic derived class
smartell Apr 1, 2015
689b828
Now have an actual likelihood from the derived class multivariateLogi…
smartell Apr 1, 2015
f2c99bc
removed old code
smartell Apr 1, 2015
459360c
Have aggregation working for dmvlogistic and abstract base class, res…
smartell Apr 1, 2015
b8a9d8a
Now have multivariateLogistic producing the same results with aggrega…
smartell Apr 1, 2015
d7db409
Commented out COUT statements from debugging
smartell Apr 1, 2015
3fe5a26
tsting multivariateLogistic, need to fix bug in residuals.
smartell Apr 2, 2015
2ba25e2
Deleted pointer for age comps likelihoods
smartell Apr 2, 2015
91a2bfd
Started multinomial base class
smartell Apr 2, 2015
5ea1ad6
Started multinomial base class
smartell Apr 2, 2015
e966ce6
Appear to have multinomial working. But still needs testing.
smartell Apr 3, 2015
46af58b
Added multinomial with effective sample size
smartell Apr 3, 2015
1017f1d
Multinomial with effective sample size estimated
smartell Apr 3, 2015
594b59d
Did some speed tests with compositionLikelihoods.hpp. 7X slower, so …
smartell Apr 3, 2015
5b3583c
Modification to Halibut Data file to stirp 00s of age comps.
smartell Apr 3, 2015
8ed8801
Nearly fixed all age comp plots, need to fix age labels on plotAgeSum…
smartell Apr 4, 2015
7294de0
FIxed axis on plotAgeSummary.R
smartell Apr 4, 2015
745d7ba
FIxed more Rscrpts for autmated ploting. Parse Halibut age comps by a…
smartell Apr 4, 2015
ebc13d2
Stash
smartell Apr 4, 2015
7135a1d
Fixed legend in plotageSummary
smartell Apr 4, 2015
f7a8cc9
trimed the number of qdev parameters when conducting prospective anal…
smartell Apr 4, 2015
34a7310
Added retropsecitve adjustment to qdev_count
smartell Apr 4, 2015
74c8635
Fixed the data file, wrong years for jumps in Q.
smartell Apr 10, 2015
38904bf
Added qdeve plot
smartell Apr 10, 2015
50fe871
Better fits to the halibut model, fixed likelihood for first-differne…
smartell Apr 11, 2015
2a9edc5
new Age Barplot
smartell Apr 11, 2015
7a5f9c0
Adding lines to age bars
smartell Apr 13, 2015
bae2f68
PlotAgebars now available
smartell Apr 13, 2015
11ac51c
Added new controls to control file, and read in DATA_SECTION
smartell Apr 13, 2015
639904e
Implemented slx_log_par
smartell Apr 13, 2015
d574c45
chk point
smartell Apr 14, 2015
a844b25
New Selex class interface now starting to work for Logistic only
smartell Apr 15, 2015
528f7f7
annual cubic splines working
smartell Apr 17, 2015
4cf8ba6
Bicubic spline working
smartell Apr 17, 2015
cba68f9
Bicubic spline working
smartell Apr 17, 2015
dbea682
Testing sex-specific selex curves
smartell Apr 17, 2015
31b24c0
Added penalties to objective function for NEW_SELEX
smartell Apr 18, 2015
497dfdf
Stash with NEW_SELEX undefined
smartell Apr 18, 2015
e451a96
Still working on penalties and constraints for new slx params.
smartell Apr 19, 2015
37751db
commented out define NEW_SELEX. Issue with transposing the parameter…
smartell Apr 20, 2015
06c9e31
More tweaks to Selectivity and control file for halibut
smartell Apr 20, 2015
35e5527
Run using bicubic splines for all fisheries.
smartell Apr 21, 2015
e9523e0
Fixed bug in case 2 of calc_slx
smartell Apr 22, 2015
8274a99
Fixed bug in case 2 of calc_slx
smartell Apr 22, 2015
7617264
Updated template control file
smartell Apr 22, 2015
3ed08fd
FIxed relative paths in R4iSCAM.R
smartell Apr 22, 2015
23d947b
Added new plotSelex.R script
smartell Apr 22, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,3 +279,6 @@ _____________________________________________________________
Last changed on:
Source code: https://github.com/smartell/iSCAM
_____________________________________________________________

## Code Changes
- March 30, 2015. Added time varying catchbility options (random walk).
6 changes: 3 additions & 3 deletions examples/makeproject
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ gsed -i "0,/^CTL=/s/^CTL=/CTL=$1/" $1/DATA/Makefile

cp ../scripts/Template.dat $1/DATA/$1.dat
cp ../scripts/Template.ctl $1/DATA/$1.ctl
cp ../scripts/Template.pfc $1/DATA/$1.pfc
cp ../scripts/Template.mpc $1/DATA/$1.mpc
cp ../scripts/Template.pfc $1/DATA/$1.pfc
cp ../scripts/Template.mpc $1/DATA/$1.mpc
cp ../scripts/Template.scn $1/DATA/$1.scn
cp ../scripts/buildRdata.R $1/R/buildRdata.R
cp ../scripts/buildRdata.R $1/R/buildRdata.R
cp ../scripts/collectAll.R $1/R/collectAll.R
cp ../scripts/saveMSEdataframe.R $1/R/saveMSEdataframe.R

Expand Down
2 changes: 1 addition & 1 deletion fba/HALIBUT/DATA/DMVL1888/Halibut2014.ctl
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
2.0 # 3 -std in observed catches in first phase.
1.0 # 4 -std in observed catches in last phase.
1 # 5 -Assume unfished in first year (0=FALSE, 1=TRUE)
0.00 # 6 -Minimum proportion to consider in age-proportions for dmvlogistic
1.00 # 6 -Maternal effects power parameter (1.0 = no maternal effects)
0.30 # 7 -Mean fishing mortality for regularizing the estimates of Ft
0.10 # 8 -std in mean fishing mortality in first phase
2.00 # 9 -std in mean fishing mortality in last phase
Expand Down
174 changes: 125 additions & 49 deletions fba/HALIBUT/DATA/DMVL1988/Halibut2014.ctl

Large diffs are not rendered by default.

460 changes: 230 additions & 230 deletions fba/HALIBUT/DATA/Halibut2014.dat

Large diffs are not rendered by default.

15 changes: 12 additions & 3 deletions fba/HALIBUT/R/R4iSCAM.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ setwd(.PWD)
.THEME <- theme_bw(12)
.UNITS <- "(mlb)"

# | Labels for gear sex area and group index.
.GEAR = c("Directed","Wasteage","Bycatch","Sport","Personal","Setline Survey")
.SEX = c("F & M","Female","Male")
.AREA = c("Coast wide")
.GROUP = c("Pacific Halibut")


.srcRlib <- function()
{
Expand Down Expand Up @@ -59,19 +65,22 @@ for(nm in .RFILES) source(file.path(.LIB, nm), echo=FALSE)
.plotCatch( M )
.plotIndex( M )
.plotWeightAtAge( M )
.plotAgeComps( M )
.plotAgeCompResiduals( M )
.plotAgeSummary( M )
.plotSpawnBiomass( M )
.plotDepletion( M )
.plotMortality( M )
.plotRecruitment( M )
.plotStockRecruit( M )
.plotRecruitsPerSpawner( M )
.plotSurveyFit( M )
.plotQ( M )
.plotCatchResidual( M )
.plotIndexResidual( M )
.plotRecruitmentResidual( M )
.plotAgeComps( M )
.plotAgeCompResiduals( M )
.plotAgeSummary( M )
.plotAgeBars( M )
.plotSlx( M )

# |----------------------------------------------------------------------------------|
# | guiView: Main function for starting the iSCAM Gui
Expand Down
219 changes: 148 additions & 71 deletions scripts/Template.ctl

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions src/R/R4iSCAM.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
# | .RFILES <- List of R functions to source from the lib directory.
# .PWD <- "/Users/stevenmartell1/Documents/iSCAM/examples/PacificHake14/R"
.PWD <- "/Users/stevenmartell1/Documents/iSCAM-project/src/R"
.LIB <- "../../../dist/R/lib/"
.WIN <- "../../../dist/R/iScamWin2.txt"
.LIB <- "../../../src/R/lib/"
.WIN <- "../../../src/R/iScamWin2.txt"
setwd(.PWD)
.FIGUREDIR <- "../FIGS/"
.RFILES <- list.files(.LIB,pattern="\\.[Rr]$")
Expand All @@ -37,19 +37,22 @@ for(nm in .RFILES) source(file.path(.LIB, nm), echo=FALSE)
.plotCatch( M )
.plotIndex( M )
.plotWeightAtAge( M )
.plotAgeComps( M )
.plotAgeCompResiduals( M )
.plotAgeSummary( M )
.plotSpawnBiomass( M )
.plotDepletion( M )
.plotMortality( M )
.plotRecruitment( M )
.plotStockRecruit( M )
.plotRecruitsPerSpawner( M )
.plotSurveyFit( M )
.plotQ( M )
.plotCatchResidual( M )
.plotIndexResidual( M )
.plotRecruitmentResidual( M )
.plotAgeComps( M )
.plotAgeCompResiduals( M )
.plotAgeSummary( M )
.plotAgeBars( M )
.plotSlx( M )


# |----------------------------------------------------------------------------------|
Expand Down
70 changes: 70 additions & 0 deletions src/R/lib/plotAgeBars.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# plotAgeBars.R
library(reshape2)
library(ggplot2)


.plotAgeBars <- function( M )
{
n <- length( M )
cat(".plotAgeBars\n")
id <- grep("d3_A[1-9]",names(M[[1]]))
iu <- grep("A_hat[1-9]",names(M[[1]]))
hr <- c("Year","Gear","Area","Group","Sex","AgeErr")
mdf <- NULL
mcol<- -1:-7
for(i in 1:n)
{
getDF <- function(x)
{
ix <- id[x]
jx <- iu[x]

age <- seq(M[[i]]$n_A_sage[x],M[[i]]$n_A_nage[x])
df <- data.frame(V="Observed",M[[i]][[ix]])
df[,mcol] <- df[,mcol]/rowSums(df[,mcol],na.rm=TRUE)
# cat("\nSum of observed = ",rowSums(df[,-1:-6]))
colnames(df) = c("V",hr,paste(age))

dp <- data.frame(V="Predicted",M[[i]][[ix]][,1:6],M[[i]][[jx]])
dp[,mcol] <- dp[,mcol]/rowSums(dp[,mcol],na.rm=TRUE)
# cat("\nSum of predicted = ",rowSums(dp[,-1:-6]))
colnames(dp) = c("V",hr,paste(age))

dfp <- rbind(df,dp)
dfp <- subset(dfp,Year %in% seq(M[[i]]$syr,M[[i]]$nyr))
return(dfp)
}

B <- lapply(1:length(id),getDF)
}



barplot <- function(B)
{
mB <- melt(B,id.vars=c("V",hr))
mB$BroodYear <- mB$Year - as.integer(mB$variable)


O <- subset(mB,V=="Observed")
I <- subset(mB,V=="Predicted")

klbl <- .GEAR[O$Gear]
albl <- .AREA[O$Area]
glbl <- .GROUP[O$Group]
slbl <- .SEX[O$Sex+1]

p <- ggplot(O,aes(variable,as.double(value),fill=BroodYear))
p <- p + geom_bar(stat="identity",alpha=0.7)
p <- p + scale_fill_distiller(type = "div")
p <- p + geom_line(data=I,aes(as.numeric(variable),value),color="red")
p <- p + labs(x="Age",y="Proportion")
p <- p + ggtitle(paste(klbl,":Area",albl,":Group",glbl,":Sex",slbl))
p <- p + guides(title.position = "top")
p <- p + facet_wrap(~Year)+coord_flip()
return (p + .THEME + theme(legend.position="top") + theme_bw(8))
}

P <- lapply(B,barplot)
print(P)
}
Loading