Hi all -
Let's say I have a data generating process for some observation i in group j:
y(i, j) ~ GP(mean process (X(i, j)), covariance function(X(i, j) | group level parameters (j) ) )
where group level parameters in the covariance function come from some hyperdistribution.
This parameter distribution _is_ the research question. Each group has a different number of
observations.
I'm currently implementing this by building up each group's covariance matrix with its own
group-level parameters, and then using a very large block-diagonal covariance matrix to store
all the group-specific covariance matrices. I am doing this in the transformed parameters block.
My estimation model is then
y ~ GP(mean process, enormous block-diagonal covariance matrix)
This works well for a small number of groups (10), but obviously doesn't scale well to the full
dataset.
In the full dataset, there are 65 groups with group sizes of around 15, so the resulting large
covariance matrix would be around 99% 0 entries. I'm not using any sparse structures.
How should I go about using the sparse data structures to help with the scaling? In particular, given
I'm generating the giant covariance matrix in the transformed parameters, is there a way to
call `csr_extract_v` and `csr_extract_u` in that block, so I can reassemble the dense covariance
matrix in the model block? Or should I be constructing the enormous matrix as a local variable
(to my mind, this will be very slow, it being evaluated every leapfrog step)? Or something else?
Thoughts?
Jim