pfmc-assessments / VASTWestCoast

VAST for the NWFSC West Coast data
Other
5 stars 1 forks source link

NA in gradient error in "out" object for WCGBTS survey #37

Open kellijohnson-NOAA opened 3 years ago

kellijohnson-NOAA commented 3 years ago

VASTWestCoast is currently unable to produce estimates of abundance for the West Coast Groundfish Bottom Trawl Survey for an unknown reason. The behaviour seems to be caused by running multiple VAST models without closing out of R and opening a new session. So, for species in which the settings need to be changed, e.g., turning off overdispersion or some other parameter that is estimated close to zero, the subsequent model will NOT run. Instead, users have to quit R and restart everything.

James-Thorson-NOAA commented 3 years ago

What's your sessionInfo()? I'm curious to track and explore this issue

kellijohnson-NOAA commented 3 years ago

One of them is ... but I am having the same problem on multiple machines. It seems like the only way to remedy it is to use 100 knots or less. For what it is worth, I get similar though not exactly the same errors with sdmTMB, e.g.,

Error in optimHess(par.fixed, obj$fn, obj$gr) : 
  gradient in optim evaluated to length 1 not 22
> sessionInfo()
R Under development (unstable) (2021-01-05 r79797)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] sdmTMB_0.0.12.9000   dplyr_1.0.5          ggplot2_3.3.3        VASTWestCoast_1.1.5 
 [5] testthat_3.0.2       FishStatsUtils_2.9.0 VAST_3.7.0           TMB_1.7.19          
 [9] devtools_2.3.2       usethis_2.0.1       

loaded via a namespace (and not attached):
 [1] rnaturalearth_0.1.0     pkgload_1.2.0           jsonlite_1.7.2         
 [4] splines_4.1.0           ThorsonUtilities_1.0    assertthat_0.2.1       
 [7] sp_1.4-5                pander_0.6.3            remotes_2.2.0          
[10] sessioninfo_1.1.1       pillar_1.5.1            lattice_0.20-41        
[13] glue_1.4.2              chron_2.3-56            digest_0.6.27          
[16] colorspace_2.0-0        Matrix_1.3-2            plyr_1.8.6             
[19] pkgconfig_2.0.3         nwfscSurvey_2.0         purrr_0.3.4            
[22] scales_1.1.1            processx_3.4.5          tibble_3.1.0           
[25] proxy_0.4-25            mgcv_1.8-33             generics_0.1.0         
[28] ellipsis_0.3.1          cachem_1.0.4            withr_2.4.1            
[31] cli_2.3.1               magrittr_2.0.1          crayon_1.4.1           
[34] memoise_2.0.0           ps_1.6.0                fs_1.5.0               
[37] fansi_0.4.2             nlme_3.1-151            class_7.3-17           
[40] pkgbuild_1.2.0          tools_4.1.0             prettyunits_1.1.1      
[43] lifecycle_1.0.0         stringr_1.4.0           munsell_0.5.0          
[46] callr_3.5.1             compiler_4.1.0          e1071_1.7-6            
[49] rlang_0.4.10            classInt_0.4-3          units_0.7-1            
[52] grid_4.1.0              rstudioapi_0.13         tweedie_2.3.3          
[55] INLA_21.02.23           TMBhelper_1.3.0         gtable_0.3.0           
[58] DBI_1.1.1               curl_4.3                reshape2_1.4.4         
[61] R6_2.5.0                knitr_1.31              fastmap_1.1.0          
[64] utf8_1.2.1              rprojroot_2.0.2         KernSmooth_2.23-18     
[67] desc_1.3.0              stringi_1.5.3           parallel_4.1.0         
[70] Rcpp_1.0.6              vctrs_0.3.6             sf_0.9-8               
[73] tidyselect_1.1.0        xfun_0.22               rnaturalearthdata_0.2.0

This R session worked with 100 knots

> sessionInfo()
R Under development (unstable) (2020-12-07 r79587)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] VASTWestCoast_1.1.5  testthat_3.0.2       FishStatsUtils_2.9.1 VAST_3.7.1          
[5] TMB_1.7.19           devtools_2.3.2       usethis_2.0.1       

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.6              rnaturalearth_0.1.0     lattice_0.20-41         prettyunits_1.1.1      
 [5] class_7.3-17            ps_1.6.0                digest_0.6.27           assertthat_0.2.1       
 [9] rprojroot_2.0.2         utf8_1.2.1              tweedie_2.3.3           nwfscSurvey_2.0        
[13] plyr_1.8.6              R6_2.5.0                chron_2.3-56            rnaturalearthdata_0.1.0
[17] e1071_1.7-4             ggplot2_3.3.3           pillar_1.5.1            ThorsonUtilities_1.0   
[21] rlang_0.4.10            rstudioapi_0.13         callr_3.6.0             Matrix_1.3-2           
[25] desc_1.3.0              splines_4.1.0           rgdal_1.5-23            pander_0.6.3           
[29] stringr_1.4.0           munsell_0.5.0           compiler_4.1.0          xfun_0.22              
[33] pkgconfig_2.0.3         pkgbuild_1.2.0          tidyselect_1.1.0        tibble_3.1.0           
[37] RANN_2.6.1              fansi_0.4.1             TMBhelper_1.3.0         crayon_1.4.1           
[41] dplyr_1.0.2             withr_2.4.1             sf_0.9-6                grid_4.1.0             
[45] jsonlite_1.7.2          gtable_0.3.0            lifecycle_1.0.0         DBI_1.1.1              
[49] magrittr_2.0.1          units_0.6-7             scales_1.1.1            KernSmooth_2.23-18     
[53] stringi_1.5.3           cli_2.3.1               cachem_1.0.4            INLA_21.02.23          
[57] reshape2_1.4.4          fs_1.5.0                remotes_2.2.0           sp_1.4-4               
[61] ellipsis_0.3.1          generics_0.1.0          vctrs_0.3.6             tools_4.1.0            
[65] glue_1.4.2              purrr_0.3.4             parallel_4.1.0          processx_3.5.0         
[69] pkgload_1.2.0           fastmap_1.1.0           colorspace_2.0-0        sessioninfo_1.1.1      
[73] classInt_0.4-3          memoise_2.0.0           knitr_1.31   
kellijohnson-NOAA commented 3 years ago

@ericward-noaa alerted me to warnings wrt to the Matrix package.

James-Thorson-NOAA commented 3 years ago

I haven't seen that Matrix issue causing problems using Windows, but please do update here if that (or something else) solves it! Sorry that I don't have more ideas :0