Closed adam2392 closed 2 years ago
Another related issue is how to store VAR models with lags that occur in multiple epochs. So we pass in EEG data, epoched (maybe these are contiguous windows over time made with make_fixed_length_epochs
), then the data will be (n_epochs, n_chs, n_samples)
.
If we just worry about storing VAR(1) model, or a traditional linear dynamical system, then we only get an EpochConnectivity
container in return that stores (n_epochs, n_chs, n_chs)
.
If we now get a VAR(p) model, we get data that looks like: (n_epochs, lags, n_chs, n_chs)
(how it is stored in statsmodels minus the epochs dimension), or (n_epochs, n_chs * lags, n_chs)
(current implementation). If we account for an additional "lags" dimension, not sure if "EpochConnectivity" is the best container anymore.
Should I explore a hack to see if we can still use EpochConnectivity, but handle special cases, where lags
is defined?, or should I consider creating a new say... EpochVARConnectivity container just for VAR models?
cc: @larsoner @agramfort @britta-wstnr
If we now get a VAR(p) model, we get data that looks like: (n_epochs, lags, n_chs, n_chs) (how it is stored in statsmodels minus the epochs dimension), or (n_epochs, n_chs * lags, n_chs) (current implementation). If we account for an additional "lags" dimension, not sure if "EpochConnectivity" is the best container anymore.
Wouldn't it just be EpochTemporalConnectivity
at that point? The lags are really time, right?
Hmmm, yeah we could represent them as "times" with the proper documentation. Although if you have a sliding VAR(p), then we just need to be careful of how we explain this.
I think the only remaining question I have is: should we handle "trends"? This causes issues with the shape of the data structure stored.
I don't think so, because we aren't modeling some traditional time series? However, if ppl feel strongly, I can figure out how to make it work.
I agree with @larsoner that we can just use EpochTemporalConnectivity
for this (and document, maybe also have a good example).
Regarding trends: I would wait and see if anyone ever needs it, you are right that it is probably not used a lot with neuroscientific data.
Right now, we need to consolidate options for VAR modeling:
Moreover, if we take code from
statsmodels
for the vector AR estimating process, we might as well take theirselect_order
function to allow users to also include a "select lag order" of their VAR model using information criterion.All this functionality should be tested either:
pinv
Related to: https://github.com/mne-tools/mne-connectivity/issues/28