Closed James-Thorson closed 5 years ago
Exploring this topic a bit further, and the supporting functions needing to be changed are:
use_fine_scale_covariates=TRUE
which triggers using Extrapolation_List[["Data_Extrap"]][,c('Lat','Lon')]
instead of Spatial_List$loc_x
\FishStatsUtils::make_map_info
-- must be changed to be compatible with new option.I'll keep adding to this list as I explore
At the same time as adding fine-scale covariates, I will likely want to add a feature to interpolate values of random-fields for each grid cells x
given three nearby knots s
. This would require the following changes:
A = INLA::inla.spde.make.A( anisotropic_mesh, as.matrix(Extrapolation_List$Data_Extrap[,c("E_km","N_km")]) )
. However, some extrapolation-grid cells are currently outside of the INLA boundary mesh and therefore are not associated with any knots. I would need to expand the boundary outside the extrapolation-grid. However, I can't seem to do this in INLA, e.g., mesh <- inla.mesh.2d( Extrapolation_List$Data_Extrap[,c("E_km","N_km")], max.n.strict=100, n=20 )
doesn't seem to work.
I have finally addressed this in a series of changes in release 3.0.0 using option fine_scale=TRUE
and please see the User Manual and other documentation for details if interested.
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, andn_s
as the number of interior and boundary knots.n_x
withn_knots
, and usen_knots
to calculate the number of interior knots (identical to previous definition ofn_x
)s_i
withx_i
ands_x
, wherex_i(i)
is returns the value ofx
for each observationi
(as used in density covariates) ands_x(x)
gives the SPDE vertexs
associated with each piecewise-constant knotx
, so thats_x(x_i(i))
gives the SDPE vertexs
associated with each observationi
. By default,s_x=1:TmbData$n_x-1
andx_i
is identical to previouss_i
(i.e., each piecewise-constant knot is associated with only one SPDE vertex)use_fine_scale_covariates
whereuse_fine_scale_covariates=FALSE
works as previously, butuse_fine_scale_covariates=TRUE
redefinesn_x
to be the number of cells in the extrapolation grid and calculatesX_xtp
,X_xp
,a_xl
, andZ_xm
appropriatelyThis 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.