James-Thorson-NOAA / VAST

Spatio-temporal analysis of univariate or multivariate data, e.g., standardizing data for multiple species or stages
http://www.FishStats.org
GNU General Public License v3.0
124 stars 53 forks source link

Tweedie causes the R bomb #362

Open rooperc4 opened 1 year ago

rooperc4 commented 1 year ago

I have been trying to fit a model to trawl survey data from BC using a tweedie distribution. Using VAST_v14_0_1, FishStatsUtils 2.12.0, INLA_22.12.16 and TMB V_1.9.1 and R V4.2.2. Attached are my settings files and below the code. This is a recent behaviour, in that I just was forced to upgrade R, Rstudio, VAST, TMB, INLA et al. It seemed to work previously. Also, seems to work fine for other models (deltagamma, deltalognormal).

When I go back to R 4.1.8 it seems to work (at least it goes through the process of estimating parameters and appears to finish), but has been running for about 24 hours and hasn't yet spit out the resulting model. Maybe the same issue, but without the R bomb?

settings = make_settings( n_x = 100, Region = 'User', purpose = "index2", use_anisotropy = FALSE, ObsModel= c(10,2),#tweedie FieldConfig=c("Omega1"=0,"Omega2"="1","Epsilon1"=0,"Epsilon2"="1"),

FieldConfig = matrix( c(0,0,0,"IID","IID","IID"), ncol=2, nrow=3, dimnames=list(c("Omega","Epsilon","Beta"),c("Component_1","Component_2"))),

bias.correct = FALSE) user_region <- readRDS('user_region.rds')

fit = fit_model( settings = settings, Lat_i = Data_Geostat[,'Lat'], Lon_i = Data_Geostat[,'Lon'], t_i = Data_Geostat[,'Year'], b_i = Data_Geostat[,'Catch_KG'], a_i = Data_Geostat[,'AreaSwept_km2'], working_dir=paste0(getwd(),"/biomass/tweedie/"), v_i = Data_Geostat[,'Vessel'] ,input_grid=user_region,newtonsteps = 0,getsd=FALSE)

plot(fit,working_dir=paste0(getwd(),"/biomass/tweedie/")) settings.txt