View source: R/single_view_embedding_for_sve.R
single_view_embedding_for_sve | R Documentation |
Andy taken Luke's original and adapting it. Cumbersome function name for now, but being consistent with other new function names. Call various functions to do a single view embedding for a given set of lags as per Hao and Sugihara.
single_view_embedding_for_sve(data, response, lags, ...)
data |
[matrix()] or [data.frame()] with named [numeric()] columns |
response |
[character()] column name of the response variable in
|
lags |
[list()] of a named vector of lags for each explanatory variable. |
... |
currently just 'max_allowed_correlation' to pass onto 'state_space_reconstruction_for_sve()' |
metric |
[character()] |
[tibble()] with columns 'response', 'response_predicted' (so both in original absolute numbers, and then 'response_s' and 'response_s_predicted' both in scaled (first differenced and then scaled) co-ordinates, so we can then calculate both types of correlation coefficient (or whatever else) to rank each individual single view embedding. OR a single NA if the lagged variables are highly correlated (see 'state_space_reconstruction_for_sve()'.
Andrew M. Edwards and Luke A. Rogers
## Not run:
h_simulated <- 0.1095 + sample(1:180) * 0.001 # has mean of 0.2
simulated_4 <- EDMsimulate::salmon_sim(h = h_simulated)
res <- single_view_embedding_for_sve(data = simulated_4,
response = "R_t",
lags = create_subset_lags(list(R_t = 0:4,
S_t = 0:8
))[[16000]]) # picking a specific subset of
# potential lags
res %>% as.data.frame()
# Shows that can have R_t_predicted bigger than any original R_t, e.g. line
# 73, because R_t_s[72] was the largest possible, and previous R_t was not
# very small. This may change with different seeds, as hadn't set, but idea
# should hold.
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.