James-Thorson-NOAA / FishStatsUtils

Shared resources for spatio-temporal models
GNU General Public License v3.0
10 stars 16 forks source link

Region="other" in make_extrapolation_info #10

Closed aastarloa closed 5 years ago

aastarloa commented 5 years ago

Hello, I'm trying to fit my model by using Region="other" but I'm getting this error despite having already defined observations_LL:

Making extrapolation-grid convUL: For the UTM conversion, automatically detected zone 29. convUL: Converting coordinates within the northern hemisphere. Error in (function (Region, zone = NA, strata.limits = data.frame(STRATA = "All_areas"), : Because you're using a new Region[rI], please provide 'observations_LL' input

This is my code: Make settings settings = make_settings( n_x=50, Region="other", purpose="index", strata.limits=data.frame(STRATA="All_areas"))

Fit model fit1 = fit_model( "settings"=settings, "Lat_i"=del$Lat, "Lon_i"=del$Lon, "t_i"=del$Year, "c_i"=rep(0,nrow(del)), "b_i"=del$Encounter, "a_i"=del$Dist.km, model_args=list("ObsModel_ez[e,1]"=5), extrapolation_args = make_extrapolation_info(Region="other", strata.limits=data.frame(STRATA="All_areas"), observations_LL=del[ ,c("Lon","Lat")]))

Thank you in advance

James-Thorson commented 5 years ago

Please try:

fit1 = fit_model( "settings"=settings, "Lat_i"=del$Lat,
"Lon_i"=del$Lon, "t_i"=del$Year,
"c_i"=rep(0,nrow(del)), "b_i"=del$Encounter,
"a_i"=del$Dist.km,
model_args=list("ObsModel_ez[e,1]"=5),
extrapolation_args = list(observations_LL=del[ ,c("Lon","Lat")]))

and report back whether it fixes it.

aastarloa commented 5 years ago

Fixed! Thank you very much

James-Thorson commented 5 years ago

You'll also need to change how you're specifying ObsModel_ez either by editing its value in settings, or by changing your specification to input model_args

aastarloa commented 5 years ago

Rigth. Already done. Thank you again