View source: R/momentum_aggregate.R
momentum_aggregate | R Documentation |
momentum()
Data Frames Across Parameter CombinationsThe function momentum()
allows variable importance assessments based on several combinations of arguments at once. For example, when the argument distance
is set to c("euclidean", "manhattan")
, the output data frame will show two importance scores for each pair of compared time series and variable, one based on euclidean distances, and another based on manhattan distances.
This function computes importance stats across combinations of parameters.
If there are no different combinations of arguments in the input data frame, no aggregation happens, but all parameter columns are removed.
momentum_aggregate(df = NULL, f = mean, ...)
df |
(required, data frame) Output of |
f |
(optional, function) Function to summarize psi scores (for example, |
... |
(optional, arguments of |
data frame
Other momentum_support:
momentum_boxplot()
,
momentum_model_frame()
,
momentum_spatial()
,
momentum_stats()
,
momentum_to_wide()
#three time series
#climate and ndvi in Fagus sylvatica stands in Spain, Germany, and Sweden
tsl <- tsl_initialize(
x = fagus_dynamics,
name_column = "name",
time_column = "time"
) |>
tsl_transform(
f = f_scale_global
)
if(interactive()){
tsl_plot(
tsl = tsl,
guide_columns = 3
)
}
#momentum with multiple parameter combinations
#-------------------------------------
df <- momentum(
tsl = tsl,
distance = c("euclidean", "manhattan"),
lock_step = TRUE
)
df[, c(
"x",
"y",
"distance",
"importance"
)]
#aggregation using means
df <- momentum_aggregate(
df = df,
f = mean
)
df
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.