View source: R/multivariate_simplex.R
multivariate_simplex | R Documentation |
Take a multivariate data set containing variables through time, a response variable (the variable we care about, such as population number), and a set of lags that we wish to consider. Apply Simplex to each subset of lags. Based on ‘multiview_embedding()' which was based on Ye and Sugihara (2016)’s description of that; not sure if anyone has done this approach before (though seems fairly logical to try it).
multivariate_simplex(data, lags, response = NULL)
data |
[tibble()] or [data.frame()] with named [numeric()] columns |
lags |
[list()] of a named vector of lags for each explanatory variable. |
response |
[character()] column name of the response variable in
|
For all allowed lags, this function builds every possible state space reconstruction (Figure 1C in Ye and Sugihara), of all possible dimensions. So variable 1 with 0 lag, variable 1 with 0 lag and variable 2 with 0 lag, variable 1 with 0 lag and variable 2 with 1 lag, etc. up to variable 1 with all lag allowed from 'lags' and variable 2 with all lags allowed from 'lags'. If there are $N$ total variable-lag combinations, then there should be $2^N - 1$ possible reconstructions (each one is either in or out, minus them all being out), but this may get reduced with what is described above.
This function then calls 'pbsEDM_optimal()', for each possible state space reconstruction, which creates the state space reconstruction and makes Simplex predictions for all allowable focal times $t^*$ taking into account which neighbours should be candidates for nearest neighbours, and calculates predicted values of the response variable both scaled and unscaled. Here we will calculate metrics of the fit, based on just the response variable (as that is what we are interested in), and pick the best performing ones - the square root of the total number of reconstructions, as per Y&S for multiview embedding. Then use the average of those to make the actual forecast for the time step after the data.
TODO Also an add option to just use the best Simplex projection. Might be best to do that as default.
Returns **
[list()] **TODO
Andrew M. Edwards
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.