Hi Sam,
it's not entirely clear from the code you supplied what the data
format is, so I'll describe what you need to give as input to
inla.spde.make.A to make it work, with your current call as starting
point.
This is your code:
A_eg = inla.spde.make.A(mesh, loc = df_xyz_by_yr, index = df_block_by_yr,
block = df_block_by_yr, block.rescale = "count",
group=df_obsdat$time,n.group=n_years)
The block feature works so that when index is supplied, you must have
index, group, and block to be vectors of the length of the number of
total desired integration/summation points.
The contents of block should go from 1 through the total number of
observations, and after constructing the initial evaluation matrix,
A_raw, for the integration points, then it aggregates rows of A_raw so
that the resulting matrix A has
A[i,] <- colSums(A_raw[block == i, ])
(apart from some weighting defined by the block.rescale argument.
The fact that you have both space and time isn't really relevant; it
does not care whether you have observations for all time points for
each block or not. You must supply the complete information, so that
index[j], group[j], block[j] tells it that integration point #j should
influence observation block[j], at spatial location determined by
loc[index[j],] and "time"(=group) point group[j]
Does the above make sense?
You didn't say what actual values you expected where the error message
said it expected something other than what it was given.
We're also working on helpers for aggregated data models for the
inlabru interface, where setting up these things will be a lot easier,
just as it is for point processes now.
That also provides
ipoints(samplers, mesh)
to construct proper integration weights that doesn't rely on gridding
and inside-counting, but rather constructs a properly weighted
integration scheme for the mesh.
When the samplers is SpatialPolygonsDataFrame with one row for each
observation, and an observation ID column, this can be used to help
construct the A-matrix.
It should go something like this:
ips$ID <- seq_len(nrow(samplers))
ips <- ipoints(samplers, mesh, group = "ID")
ips$time <- samplers$time[ips$ID] # not sure if this step is needed;
check the ips contents first
A <- inla.spde.make.A(mesh, ips, group = ips$time, block = ips$ID,
weights = ips$weight, block.rescale = "none", n.group=n_years)
Finn
> --
> You received this message because you are subscribed to the Google Groups "R-inla discussion group" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
r-inla-discussion...@googlegroups.com.
> To view this discussion on the web, visit
https://groups.google.com/d/msgid/r-inla-discussion-group/bf142093-7edb-4e73-a8a4-0712a422c85dn%40googlegroups.com.
--
Finn Lindgren
email:
finn.l...@gmail.com