Giter Site home page Giter Site logo

james-thorson-noaa / vast Goto Github PK

View Code? Open in Web Editor NEW
122.0 122.0 53.0 45.22 MB

Spatio-temporal analysis of univariate or multivariate data, e.g., standardizing data for multiple species or stages

Home Page: http://www.FishStats.org

License: GNU General Public License v3.0

R 12.57% C++ 87.43%
spatial-models species-distributions thorson

vast's People

Contributors

b-steve avatar corinnebassin-noaa avatar james-thorson avatar james-thorson-noaa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vast's Issues

plot_residuals in VAST-single-species-example

Decide which years to plot

Year_Set = seq(min(Data_Geostat[,'Year']),max(Data_Geostat[,'Year']))
Years2Include = which( Year_Set %in% sort(unique(Data_Geostat[,'Year'])))

This will general error when the Year_Set is not continuous. To solve the problem, change Years2Include to
Years2Include =1: length(sort(unique(Data_Geostat[,'Year']))))

Interpreting spatial-temporal factors

A question more than an issue:

I'm looking at multispecies models with both spatial and spatial-temporal effects. I'm having a hard time understanding the Epsilon factors and how to interpret them together with the spatial Omega terms given that the species-specific loadings on the spatial factors differ from the spatio-temporal factors. Any advice?

undoing setwd() in Build_TMB_Fn?

Build_TMB_Fn changes the working directory here, and leaves the working directory in this new location, resulting in users ending up in a different working directory than where they started after running the function.

Is there a specific reason for this? If not, I would recommend doing something like

CurrentDir = getwd()
setwd(RunDir)

and then adding in

setwd(CurrentDir)

At the end of the function so that the user's working directory is the same after running the function as it was before running.

binned-poisson data

After running the model with a few diff spp and altering model settings with the positive catch rate model set to 9 (binned-poisson), the encounter model observation model will no longer accept a logit-link with or without spatial & spatial-temporal turned on with error code:

Some years and/or categories have either all or no encounters, and this is not permissible when ObsModel['Link']=0

Seems to be fixed when I alter the encounter model to a log-link. Is the way that the binned data is being fed into the encounter model also from 0 to 3 categories like the Poisson-binned abundance?

Presence/absence info on spp tried:
Species 336: 15 years have 0, 5 years have presence
Species 239: 15 years have 0, 14 years have presence
Species 54: 13 years have 0, 15 years have presence

Requirement for Prop_nonzero != 0 | 1 when using TFpred

The error below comes up when predicting using TFpred = 1. This stops you using NAs in response variable when predicting.

"stop("Some years and/or categories have either all or no encounters, and this is not permissible when ObsModel['Link']=0")"

As a workaround, you can fill the response variable with some random numbers, but might be easier to exclude from the check.

Check for and use the latest executable available

The DESCRIPTION file has an old version listed:

Package: VAST
Type: Package
Title: Vector-autoregressive spatio-temporal (VAST) model
Version: 1.1.0
Date: 2016-08-09
Author: James Thorson
...

Using file.path() to obtain a path to a directory in a platform-independent way gives a viewable list:

list.files(R.home(file.path("library", "VAST", "executables")))
[1] "VAST_v1_0_0.cpp" "VAST_v1_1_0.cpp" "VAST_v1_2_0.cpp" "VAST_v1_3_0.cpp" "VAST_v1_4_0.cpp" "VAST_v1_5_0.cpp" "VAST_v1_6_0.cpp" "VAST_v1_7_0.cpp" "VAST_v1_8_0.cpp"
[10] "VAST_v1_9_0.cpp" "VAST_v2_0_0.cpp" "VAST_v2_1_0.cpp" "VAST_v2_2_0.cpp"

And until version 10_0_0 breaks it, the following can find the latest executable (if that is desired):
substr(list.files(R.home(file.path("library", "VAST", "executables")))[length(list.files(R.home(file.path("library", "VAST", "executables"))))], 1, 11)
[1] "VAST_v2_2_0"

Hence:
Version <- substr(list.files(R.home(file.path("library", "VAST", "executables")))[length(list.files(R.home(file.path("library", "VAST", "executables"))))], 1, 11) # Latest version up to v10_0_0 - then broken.

can be used until version 10_0_0 to always use the latest executable (for a given installation).

consider adding "Advanced Topics" to documentation

@James-Thorson showed a way to start estimation at previously estimated parameters from Save$ParHat in west coast example.

Adding a few notes on options like that to an "Advanced Topics" section in either the User Manual or Example Rmarkdown files could be a good way to make such information available to more advanced users.

Update to: West_Coast_Annual_example_2017

The Data Warehouse changed their site so that now 'vessel' [changed to 'Vessel' by WCGBTS_Combo_Catch_Wt() ] is given as a name not a number. Thus,
Data_Fn(..., v_i = as.numeric(Data_Geostat[,'Vessel'])-1, ...) needs to be changed to:
Data_Fn(..., v_i = Data_Geostat$Vessel, ...)

The updated file's permalink is here:
https://github.com/John-R-Wallace/VAST_Examples_and_Scripts/blob/7189a52ae8eef098308687364aa101069d3b950a/West_Coast_Annual_example_2017.R

I tested <v_i = Data_Geostat$Vessel> against <as.numeric(as.factor((Data_Geostat[,'Vessel']))-1> and both now give the same result

During the workshop 'vessel' only worked for myself and some others as:
< as.numeric(as.factor((Data_Geostat[,'Vessel']))-1> which starts an ordinal sequence at zero.

I am unsure why Melissa had <as.numeric(Data_Geostat[,'Vessel'])-1> in her code.

plot_factors

The covariance Cov_jj passed to SpatialDFA::Rotate_Fn may be rank deficient. I changed Line 38 to L_pj = t(chol(Cov_jj,pivot=TRUE))[,1:Nfactors] in SpatialDFA::Rotate_Fn to get the Cholesky decomposition for positive semi-definite matrix.

Plot_factors()

Getting a couple of errors....

  1. FieldConfig not found - this needs to be assigned within the function or read from Data$FieldConfig
  2. Error in SpatialDFA::Rotate_Fn(Cov_jj = Cov_List[[paste0("Cov_", tolower(Par_name))]][, :
    Must provide either L_pj or Cov_jj

Possibly because the tolower in tolower(Par_name) is not compatible with how Par_name is defined.

Let me know if you'd prefer I fork, test and then push changes...

.cpp files fail to compile

When I run the example for single species as instructed, I found that four versions of .cpp files (i.e. VAST_v2_5_0, VAST_v2_5_0, VAST_v2_5_0 and VAST_v2_5_0) fail to compile. Could you please help to fix the problem? Is it possible to upload the updates of these versions to your "VAST" folder? Thank you.

VAST fails when obs_model = c(any_number, 3) for species encountered on all samples

Using EBSBTS data, in 2016 all tows encounter Gadus_macrocephalus (pacific cod), so obs_model = c(2,0) doesn't work. Following VAST::Data_Fn, tried changing obs_model to obs_model = c(2,3), to deal with fact that all samples encountered the species, but looks like objective function hits an error with that option turned on. I get the same error if I pass it another species that has samples with 0 observations in each year (Gadus_chalcogrammus) instead of Gadus_macrocephalus.

Tried running VAST::VAST--multispecies_example.Rmd with obs_model set to c(2,3) and hit same error, so doesn't appear to be a problem caused by conflicting libraries on the larger project in which I'm using VAST and first noticed the issue

error message below

Error in nlminb(start = startpar, objective = obj$fn, gradient = obj$gr,  : 
  gradient function must return a numeric vector of length 18
In addition: Warning messages:
1: In SpatialDeltaGLMM::Spatial_Information_Fn(n_x = n_x, Method = method,  :
  knots have been flipped around dateline; eastings locations and UTM zone are transformed - see loc_x_lat_long for corrected locations
2: In nlminb(start = startpar, objective = obj$fn, gradient = obj$gr,  :
  NA/NaN function evaluation

Sys.info()

                                                                                         sysname 
                                                                                          "Darwin" 
                                                                                           release 
                                                                                          "16.7.0" 
                                                                                           version 
"Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64" 
                                                                                          nodename 
                                                                                      "dano.local" 
                                                                                           machine 
                                                                                          "x86_64" 
                                                                                             login 
                                                                                       "danovando" 
                                                                                              user 
                                                                                       "danovando" 
                                                                                    effective_user 
                                                                                       "danovando" 

R. version

platform       x86_64-apple-darwin15.6.0   
arch           x86_64                      
os             darwin15.6.0                
system         x86_64, darwin15.6.0        
status                                     
major          3                           
minor          4.1                         
year           2017                        
month          06                          
day            30                          
svn rev        72865                       
language       R                           
version.string R version 3.4.1 (2017-06-30)
nickname       Single Candle  

Aleutian Islands example data interpretation seems off

DF = FishData::download_catch_rates(survey="Aleutian_Islands", species_set=Species_set)
followed by:
Extrapolation_List = SpatialDeltaGLMM::Prepare_Extrapolation_Data_Fn( Region=Region, strata.limits=strata.limits )
executes a number of preparation routines including
Prepare_AI_Extrapolation_Data_Fn.R and isn't mapping over dateline properly.
quickfix is:
Extrapolation_List$Data_Extrap$Lon <- ifelse(Extrapolation_List$Data_Extrap$Lon>0,Extrapolation_List$Data_Extrap$Lon-360,Extrapolation_List$Data_Extrap$Lon)

Not a bug but seems to be a mis-match w/ how Prepare_AI_Extrapolation_Data_Fn.R function is applied/working.

Knots

How do you make the decision on the # of knots for each region/data set. If you can direct me to one of your papers that answers this for a fish spp that works too.

Lots of warnings about suggested cpp syntax

The Build_TMB_Fn produces lots of warnings about suggested cpp syntax (first few out of 50+ warnings shown below). I still get reasonable output from running the model, but the warnings are distracting.

I'm using a

  • Windows 10,
  • VAST_v2_4_0,
  • R 3.3.3,
  • Rtools 3.4.0.1962, and
  • gcc version 4.9.3.
> TmbList <- VAST::Build_TMB_Fn("TmbData"=TmbData,
+     "RunDir"=DateFile,
+     "Version"=Version,
+     "RhoConfig"=RhoConfig,
+     "loc_x"=Spatial_List$loc_x,
+     "Method"=Method)
c:/Rtools/mingw_64/bin/g++  -I"c:/Users/ian.taylor/Documents/R/R-3.3.3/include" -DNDEBUG -Ic:/Users/IAN~1.TAY/DOCUME~1/R/R-33~1.3/library/TMB/include   -DTMB_SAFEBOUNDS -DLIB_UNLOAD=R_unload_VAST_v2_4_0  -DTMB_LIB_INIT=R_init_VAST_v2_4_0    -I"d:/Compiler/gcc-4.9.3/local330/include"     -O2 -Wall  -mtune=core2 -c VAST_v2_4_0.cpp -o VAST_v2_4_0.o
VAST_v2_4_0.cpp: In instantiation of 'Type objective_function<Type>::operator()() [with Type = CppAD::AD<double>]':
c:/Users/IAN~1.TAY/DOCUME~1/R/R-33~1.3/library/TMB/include/tmb_core.hpp:1028:7:   required from here
VAST_v2_4_0.cpp:343:25: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
   if( Options_vec(7)==0 & Options_vec(0)==0 ){
                         ^
VAST_v2_4_0.cpp:347:25: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
   if( Options_vec(7)==0 & Options_vec(0)==1 ){
                         ^
VAST_v2_4_0.cpp:457:24: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
       if( t_iz(i,z)>=0 & t_iz(i,z)<n_t ){  // isNA doesn't seem to work for IMATRIX type
                        ^
VAST_v2_4_0.cpp:485:23: warning: suggest parentheses around comparison in operand of '|' [-Wparentheses]
...

Memory allocation

Is there a way to set the memory allocation in VAST? I get this error after running the model for a long time

outer mgc: 63.42044
iter: 1 value: 299032.3 mgc: 6.017701e-05 ustep: 1
iter: 2 value: 299032.3 mgc: 7.166481e-08 ustep: 1
iter: 3 mgc: 6.286855e-15
outer mgc: 63.38675
Error: cannot allocate vector of size 2.7 Gb

compile error

Running the code for the single species VAST from https://github.com/James-Thorson/VAST/blob/master/examples/VAST--single-species_example.Rmd I got the following compile error.

TmbList = Build_TMB_Fn("TmbData"=TmbData, "RunDir"=DateFile, "Version"=Version, "RhoConfig"=RhoConfig, "loc_x"=Spatial_List$loc_x, "Method"=Method)
Note: Using Makevars in c://.R/Makevars
Error in compile(paste0(Version, ".cpp")) : Compilation failed
In addition: Warning message:
running command 'make -f "C:/PROGRA
1/R/R-331.2/etc/x64/Makeconf" -f "C:/PROGRA1/R/R-331.2/share/make/winshlib.mk" -f "C:\Users\mmaunder\AppData\Local\Temp\RtmpctHtF9\file24d83d3d4917" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="VAST_v2_0_0.dll" WIN=64 TCLBIN=64 OBJECTS="VAST_v2_0_0.o"' had status 127
compile(paste0(Version, ".cpp"))
Note: Using Makevars in c:/
/.R/Makevars
Error in compile(paste0(Version, ".cpp")) : Compilation failed
In addition: Warning message:
running command 'make -f "C:/PROGRA1/R/R-331.2/etc/x64/Makeconf" -f "C:/PROGRA1/R/R-331.2/share/make/winshlib.mk" -f "C:\Users\mmaunder\AppData\Local\Temp\RtmpctHtF9\file24d8178711c" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="VAST_v2_0_0.dll" WIN=64 TCLBIN=64 OBJECTS="VAST_v2_0_0.o"' had status 127
Version
[1] "VAST_v2_0_0"

Error in compile(paste0(Version, ".cpp")) : Compilation failed + Build_TMB_Fn?

When I run the following program: TmbList = Build_TMB_Fn(TmbData = TmbData, RunDir = DateFile, Version = Version, RhoConfig = RhoConfig, loc_x = Spatial_List$loc_x, Method = Method)

The following error occurred in the running results:
Note: Using Makevars in C:/Users/PC/Documents/.R/Makevars
Error in compile(paste0(Version, ".cpp")) : Compilation failed

Add fine-scale variation in covariates

For next major release (non-backwards compatible):

Redefine x as extrapolation-grid rather than knot, n_x as the number of extrapolation-grid cells, n_knot as user-defined number of interior knots, and n_s as the number of interior and boundary knots.

  1. replace n_x with n_knots, and use n_knots to calculate the number of interior knots (identical to previous definition of n_x)
  2. replace s_i with x_i and s_x, where x_i(i) is returns the value of x for each observation i (as used in density covariates) and s_x(x) gives the SPDE vertex s associated with each piecewise-constant knot x, so that s_x(x_i(i)) gives the SDPE vertex s associated with each observation i. By default, s_x=1:TmbData$n_x-1 and x_i is identical to previous s_i (i.e., each piecewise-constant knot is associated with only one SPDE vertex)
  3. Add new option use_fine_scale_covariates where use_fine_scale_covariates=FALSE works as previously, but use_fine_scale_covariates=TRUE redefines n_x to be the number of cells in the extrapolation grid and calculates X_xtp, X_xp, a_xl, and Z_xm appropriately

This will then allow covariates to be inputted at the scale of the extrapolation-grid, where linear predictors are a combination of coarse-scale random fields and fine-scale covariates.

related package

The TMBhelper package is also required to run the script and also the 'development' version of SpatialDeltaGLMM is required.

TMB issue

Hi Jim,
I am getting an error when trying to run the VAST package multispecies example.

Do you think this might be a TMB installation or permission issue?

Make TMB object

TmbList = Build_TMB_Fn("TmbData"=TmbData, "RunDir"=DateFile, "Version"=Version, "RhoConfig"=RhoConfig, "loc_x"=Spatial_List$loc_x)

Error in compile(paste0(Version, ".cpp")) : Compilation failed
In addition: Warning message:
running command 'make -f "C:/PROGRA1/R/R-331.1/etc/x64/Makeconf" -f "C:/PROGRA1/R/R-331.1/share/make/winshlib.mk" -f "C:\Users\ELLEN~1.YAS\AppData\Local\Temp\RtmpYtZ9IF\file2a30f7fbdd" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="VAST_v1_9_0.dll" WIN=64 TCLBIN=64 OBJECTS="VAST_v1_9_0.o"' had status 127

I installed TMB with: devtools::install_github("kaskr/adcomp/TMB")

Many thanks,
Ellen

SpatialDeltaGLMM::Plot_data_and_knots does not work

Running the command

SpatialDeltaGLMM::Plot_data_and_knots(Extrapolation_List=Extrapolation_List, Spatial_List=Spatial_List, Data_Geostat=Data_Geostat, PlotDir=DateFile )

does not produce a plot. I get the output

Loading required package: maps
Loading required package: mapdata
null device
1

Function to output spatial abundance

Jim,

In addition to the functionality to produce maps, it would be good to be able to extract the spatial density estimates into a dataframe for external plotting.

Thanks,
Paul

y_lim error on PlotIndex_Fn & Plot_range_shifts

I am having a hard time understanding where this error comes from. When running

Index = SpatialDeltaGLMM::PlotIndex_Fn(DirName=this.path, TmbData=TmbData, Sdreport=Opt[["SD"]], Year_Set=Year$Year, Years2Include=Years2Include, use_biascorr=TRUE )

SpatialDeltaGLMM::Plot_range_shifts(Report=Report, TmbData=TmbData, Sdreport=Opt[["SD"]], Znames=colnames(TmbData$Z_xm), PlotDir=this.path, Year_Set=Year_Set)

I get

Error in plot.window(...) : need finite 'ylim' values
In addition to a warning

Below is structure of the TmbData , followed by session info

str(TmbData)
List of 35
$ n_i : int 221
$ n_s : int 237
$ n_x : int 221
$ n_t : num 12
$ n_c : num 1
$ n_j : int 1
$ n_p : int 1
$ n_k : int 1
$ n_v : num 1
$ n_l : int 1
$ n_m : int 2
$ Options_vec : Named num [1:8] 1 0 0 0 0 200 1 0
..- attr(, "names")= chr [1:8] "Aniso" "R2_interpretation" "Rho_betaTF" "Alpha" ...
$ FieldConfig : Named num [1:4] 1 1 1 1
..- attr(
, "names")= chr [1:4] "Omega1" "Epsilon1" "Omega2" "Epsilon2"
$ OverdispersionConfig: Named num [1:2] -1 -1
..- attr(, "names")= chr [1:2] "Vessel" "VesselYear"
$ ObsModel : num [1:2] 2 3
$ Options : Named num [1:9] 0 0 1 0 1 0 0 0 0
..- attr(
, "names")= chr [1:9] "SD_site_density" "SD_site_logdensity" "Calculate_Range" "Calculate_evenness" ...
$ yearbounds_zz : num [1, 1:2] 0 11
$ b_i : num [1:221] 8.33 23.48 21.17 12 0 ...
$ a_i : num [1:221] 1 1 1 1 1 1 1 1 1 1 ...
$ c_i : num [1:221] 0 0 0 0 0 0 0 0 0 0 ...
$ s_i : num [1:221] 0 1 2 3 4 5 6 7 8 9 ...
$ t_iz : int [1:221, 1] 0 0 0 0 0 0 0 0 1 1 ...
$ v_i : num [1:221] 0 0 0 0 0 0 0 0 0 0 ...
$ PredTF_i : num [1:221] 0 0 0 0 0 0 0 0 0 0 ...
$ a_xl : num [1:221, 1] 52 40 20 4 36 4 36 28 4 16 ...
..- attr(, "dimnames")=List of 2
.. ..$ : NULL
.. ..$ : chr "All_areas"
$ X_xj : num [1:221, 1] 0 0 0 0 0 0 0 0 0 0 ...
$ X_xtp : num [1:221, 1:12, 1] 0 0 0 0 0 0 0 0 0 0 ...
$ Q_ik : num [1:221, 1] 0 0 0 0 0 0 0 0 0 0 ...
$ t_yz : int [1:12, 1] 0 1 2 3 4 5 6 7 8 9 ...
$ Z_xm : num [1:221, 1:2] 524 525 530 537 539 ...
..- attr(
, "dimnames")=List of 2
.. ..$ : NULL
.. ..$ : chr [1:2] "E_km" "N_km"
$ spde :List of 3
..$ M0:Formal class 'dgTMatrix' [package "Matrix"] with 6 slots
.. .. ..@ i : int [1:237] 0 1 2 3 4 5 6 7 8 9 ...
.. .. ..@ j : int [1:237] 0 1 2 3 4 5 6 7 8 9 ...
.. .. ..@ Dim : int [1:2] 237 237
.. .. ..@ Dimnames:List of 2
.. .. .. ..$ : NULL
.. .. .. ..$ : NULL
.. .. ..@ x : num [1:237] 88.34 111.16 59.16 3.11 115.34 ...
.. .. ..@ factors : list()
..$ M1:Formal class 'dgTMatrix' [package "Matrix"] with 6 slots
.. .. ..@ i : int [1:1621] 0 1 18 74 86 105 106 0 1 72 ...
.. .. ..@ j : int [1:1621] 0 0 0 0 0 0 0 1 1 1 ...
.. .. ..@ Dim : int [1:2] 237 237
.. .. ..@ Dimnames:List of 2
.. .. .. ..$ : NULL
.. .. .. ..$ : NULL
.. .. ..@ x : num [1:1621] 12.873 -3.225 -0.625 -0.833 -6.723 ...
.. .. ..@ factors : list()
..$ M2:Formal class 'dgTMatrix' [package "Matrix"] with 6 slots
.. .. ..@ i : int [1:4981] 0 1 18 39 52 53 72 73 74 85 ...
.. .. ..@ j : int [1:4981] 0 0 0 0 0 0 0 0 0 0 ...
.. .. ..@ Dim : int [1:2] 237 237
.. .. ..@ Dimnames:List of 2
.. .. .. ..$ : NULL
.. .. .. ..$ : NULL
.. .. ..@ x : num [1:4981] 3.61 1.54 -1.12 1.69e+01 2.84e-07 ...
.. .. ..@ factors : list()
$ spde_aniso :List of 9
..$ n_s : int 237
..$ n_tri : int 456
..$ Tri_Area: num [1:456] 18.19 211.96 1.46 15.03 18.78 ...
..$ E0 : num [1:456, 1:2] -8.222 30.891 -0.664 11.242 -4.54 ...
..$ E1 : num [1:456, 1:2] 3.78 -27.21 0.54 -11.76 -2.48 ...
..$ E2 : num [1:456, 1:2] 4.446 -3.682 0.124 0.521 7.016 ...
..$ TV : num [1:456, 1:3] 30 7 68 85 52 46 231 44 90 39 ...
..$ G0 :Formal class 'dgTMatrix' [package "Matrix"] with 6 slots
.. .. ..@ i : int [1:237] 0 1 2 3 4 5 6 7 8 9 ...
.. .. ..@ j : int [1:237] 0 1 2 3 4 5 6 7 8 9 ...
.. .. ..@ Dim : int [1:2] 237 237
.. .. ..@ Dimnames:List of 2
.. .. .. ..$ : NULL
.. .. .. ..$ : NULL
.. .. ..@ x : num [1:237] 88.34 111.16 59.16 3.11 115.34 ...
.. .. ..@ factors : list()
..$ G0_inv :Formal class 'dgTMatrix' [package "Matrix"] with 6 slots
.. .. ..@ i : int [1:237] 0 1 2 3 4 5 6 7 8 9 ...
.. .. ..@ j : int [1:237] 0 1 2 3 4 5 6 7 8 9 ...
.. .. ..@ Dim : int [1:2] 237 237
.. .. ..@ Dimnames:List of 2
.. .. .. ..$ : NULL
.. .. .. ..$ : NULL
.. .. ..@ x : num [1:237] 0.01132 0.009 0.0169 0.32144 0.00867 ...
.. .. ..@ factors : list()
$ M0 :Formal class 'dgTMatrix' [package "Matrix"] with 6 slots
.. ..@ i : int [1:491] 0 1 2 3 4 5 6 7 8 9 ...
.. ..@ j : int [1:491] 0 1 2 3 4 5 6 7 8 9 ...
.. ..@ Dim : int [1:2] 491 491
.. ..@ Dimnames:List of 2
.. .. ..$ : NULL
.. .. ..$ : NULL
.. ..@ x : num [1:491] 1 1 1 1 1 1 1 1 1 1 ...
.. ..@ factors : list()
$ M1 :Formal class 'dgTMatrix' [package "Matrix"] with 6 slots
.. ..@ i : int [1:1604] 1 4 0 5 3 6 2 7 0 5 ...
.. ..@ j : int [1:1604] 0 0 1 1 2 2 3 3 4 4 ...
.. ..@ Dim : int [1:2] 491 491
.. ..@ Dimnames:List of 2
.. .. ..$ : NULL
.. .. ..$ : NULL
.. ..@ x : num [1:1604] 1 1 1 1 1 1 1 1 1 1 ...
.. ..@ factors : list()
$ M2 :Formal class 'dgTMatrix' [package "Matrix"] with 6 slots
.. ..@ i : int [1:1480] 5 4 7 6 1 8 10 0 9 11 ...
.. ..@ j : int [1:1480] 0 1 2 3 4 4 4 5 5 5 ...
.. ..@ Dim : int [1:2] 491 491
.. ..@ Dimnames:List of 2
.. .. ..$ : NULL
.. .. ..$ : NULL
.. ..@ x : num [1:1480] 1 1 1 1 1 1 1 1 1 1 ...
.. ..@ factors : list()

sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.3 LTS

Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

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

other attached packages:
[1] broom_0.4.2 bindrcpp_0.2 pander_0.6.1 doSNOW_1.0.14
[5] snow_0.4-2 iterators_1.0.8 foreach_1.4.3 ThorsonUtilities_1.0
[9] TMB_1.7.11 VAST_1.5.0 SpatialDeltaGLMM_3.4.0 rmarkdown_1.6.0.9009
[13] orthopolynom_1.0-5 polynom_1.3-9 splancs_2.01-40 arm_1.9-3
[17] lme4_1.1-14 Matrix_1.2-10 MASS_7.3-47 rgdal_1.2-15
[21] PBSmapping_2.70.4 maptools_0.9-2 sp_1.2-5 reshape_0.8.7
[25] stringr_1.2.0 dplyr_0.7.4 purrr_0.2.4 readr_1.1.1
[29] tidyr_0.7.2 tibble_1.3.4 tidyverse_1.1.1 scales_0.5.0.9000
[33] devtools_1.13.3 RColorBrewer_1.1-2 ggmap_2.6.1 ggplot2_2.2.1.9000
[37] ggthemes_3.4.0 magrittr_1.5 data.table_1.10.4

loaded via a namespace (and not attached):
[1] nlme_3.1-131 lubridate_1.6.0 httr_1.3.1 rprojroot_1.2 tools_3.4.0
[6] backports_1.1.0 R6_2.2.2.9000 lazyeval_0.2.0 colorspace_1.3-2 withr_2.1.0
[11] tidyselect_0.2.2 mnormt_1.5-5 compiler_3.4.0 rvest_0.3.2 xml2_1.1.1
[16] labeling_0.3 psych_1.7.5 digest_0.6.12 foreign_0.8-67 minqa_1.2.4
[21] jpeg_0.1-8 pkgconfig_2.0.1 htmltools_0.3.6 maps_3.2.0 rlang_0.1.2
[26] readxl_1.0.0 shape_1.4.3 bindr_0.1 jsonlite_1.5 TMBhelper_1.0
[31] geosphere_1.5-5 Rcpp_0.12.13 munsell_0.4.3 abind_1.4-5 proto_1.0.0
[36] stringi_1.1.5 plyr_1.8.4 grid_3.4.0 forcats_0.2.0 lattice_0.20-35
[41] INLA_17.06.20 haven_1.0.0 splines_3.4.0 mapproj_1.2-5 hms_0.3
[46] knitr_1.17 rjson_0.2.15 reshape2_1.4.2 codetools_0.2-15 glue_1.2.0
[51] evaluate_0.10.1 mapdata_2.2-6 modelr_0.1.0 png_0.1-7 nloptr_1.0.4
[56] RgoogleMaps_1.4.1 cellranger_1.1.0 RANN_2.5.1 gtable_0.2.0 assertthat_0.2.0
[61] coda_0.19-1 memoise_1.1.0

time varying catchability

Just a quick question on the catachability Q_ik. Would adding more columns in the "k" dimension allow for temporal variability in catchability?

Index calculations with random walks on

Fitting the Gulf of Alaska trawl survey data (with two species) and wanting to fill in the years between triennial and biennial surveys. I am using a RhoConfig of c(2,2,2,2). Looking at the raw data files it is doing something, but not really sensible between years. The SpatialDeltaGLMM::PlotIndex_Fn doesn't seem to work when use_bias_corr is on. The plot is of the two indices without bias correction. The plotIndex function looks for a column called unbiased in Sdreport, which appears to have this column but only NAs. The optimization was done as so:

Opt = TMBhelper::Optimize( obj=Obj, lower=TmbList[["Lower"]], upper=TmbList[["Upper"]], getsd=TRUE, savedir=DateFile, bias.correct=TRUE,newtonsteps=0)

In the TMBHelper::Optimize function I can't figure out any way that the option "bias.correct" =TRUE is utilized but that might be my failure to understand the code. Hopefully others have had better luck with data that is not annual. I probably should only be doing a single species example here, but it should be the same issue.

Thanks all,
Cheers,
Dana

index

Covariate matrix dimension size

Had a question about dimension sizes related to including a matrix of fixed covariates (X_xj). The X_xj matrix has the same number of rows as spatial knots (n_x) when I would have expected it to have the same dimension as individual observations (n_i). Why is that and can you provide guidance or an example as to how one should consolidate covariate data? Would it be okay if covariate data is indexed to observations (n_i)? Below is an example for calculating eta1_x:

Current in VAST_v2_6_0.cpp file:
Line 428: vector eta1_x = X_xj * gamma1_j.matrix();
Line 470: P1_i(i) = Omega1_sc(s_i(i),c_i(i)) + eta1_x(s_i(i)) + zeta1_i(i) + eta1_vc(v_i(i),c_i(i));

Proposed Change:
vector eta1_i(n_i);
eta1_i = X_ij * gamma1_j.matrix();
P1_i(i) = Omega1_sc(s_i(i),c_i(i)) + eta1_i(i) + zeta1_i(i) + eta1_vc(v_i(i),c_i(i));

error message

Hi,
In estimate fixed effects and predict random effects using this code I received an error message.

Opt = TMBhelper::Optimize( obj=Obj, lower=TmbList[["Lower"]], upper=TmbList[["Upper"]], getsd=TRUE, savedir=DateFile, bias.correct=TRUE )

Error in sparseHessianFun(env, skipFixedEffects = skipFixedEffects) :
Memory allocation fail in function 'MakeADHessObject2'

Any thoughts on why I am getting this message?
Thank you

X_xtp formatting help

I have been trying to look for some documentation on how to format X_xtp, does anyone know of something? Or can anyone give me help on how to formate this? I would like to be able to add a temperature, salinity, and depth to my analysis. Those three covariates change for each data point. Thanks!

Add identifiability check for Q_ik and X_xtp

It would be great to add an identiability check for Q_ik (and possibily X_xtp). This would involve inferring the intercepts from the RhoConfig and then column-concatenating the two, taking the covariance and eigen-decomposition, and checking its rank.

update a few things in example script

I just worked through /examples/VAST--single-species_example.Rmd and found it very informative and clearly put together. Here are three minor issues that occurred to me along the way:

  • The PDF is appealing compared to the Rmd file because it includes inline images and expected output. However, the PDF doesn't including the crucial function calls in the section "Data-frame for catch-rate data".
  • Consider adding "pander" to the packages installed in the "Getting started" section or make it a dependency of VAST. I presume pander is just used for formatting the PDF, but for the naive user copying and pasting commands, it would be convenient to avoid the error message that the package isn't available.
  • Increment the date to reflect most recent edits to the file.

Too many zeroes?

I have a general question regarding delta models. Is there such a thing as too many zeroes? My ichthyoplankton catch data has 76% to 94% zeroes (depending on the taxa and year); the total number of stations is 140. I am wondering whether the positive catch rate part of a delta model would be informative for data that have as low as 6 non-zero observations. But perhaps a delta model would be useful for data that have 34 non-zero observations?

Q about list of all fixed and random effects

Hi Jim,

The SSC groundfish sub-committee chair requested to include a table in assessment reports that would list all the fixed and random effects used in VAST. What would the best way to get such a list?

Thank you.

Modify Rmarkdown PDF...

... to make sure that the code loading Data_Geostat for each case-study example is visible, so that users can work through the code in either the Rmarkdown or compiled-PDF versions. ht Mark Maunder

Fix `PlotIndex_Fn` for NEFSC

PlotIndex_Fn doesn't appear to work in NEFSC species in Rmarkdown example due to strata_names input, ht Chuck Adams

Error with Data_Fn

Hi Jim
Got the following error while trying to run a dataset containing a year with 100% positive tows:
Error in Data_Fn(Version = Version, FieldConfig = FieldConfig, OverdispersionConfig = OverdispersionConfig, :
Some years and/or categories have either all or no encounters, and this is not permissible when ObsModel['Link']=0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.