View source: R/state_space_distances_for_sve.R
state_space_distances_for_sve | R Documentation |
Given a state-space reconstruction, return the distances between focal points (rows) and each candidate nearest neighbour, having ruled out non-candidate potential neighbours. Adapted from 'state_space_distances()'.
state_space_distances_for_sve(ssr)
ssr |
[matrix()] a state space reconstruction in which the rows are points in the state space, each row is a time |
[matrix()] of allowed neighbour distances, rows corresponding to focal point time, columns to neighbour point time. The value represents the distance from the focal point to the neighbour point. Disallowed focal point and neighbour combinations have value NA. Original 'state_space_distances()' had an upper triangular matrix to exclude future points, but not doing that here – want to utilise the full state-space reconstruction.
Luke A. Rogers
## Not run:
# From vignette:
simulated <- EDMsimulate::salmon_sim()
ssr_5 <- state_space_reconstruction_for_sve(data = simulated[1:15, ], lags = list(S_t = 1))
# TODO - correc this after correcting function, need to better deal with
neighbours that don't hav a projection - hadn't thought of possibility of
being the final row.
# So no lag of 0, so final row is complete, so distances come out with only
NA's in first column and first row, not final row like when we have a lag
of 0 --- may be wrong once correct it).
ssr_5
So just the S_t_s_1 column, which is correct.
'distances_5 <- state_space_distances_for_sve(ssr_5)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.