momentum_aggregate {distantia} | R Documentation |
Aggregate momentum()
Data Frames Across Parameter Combinations
Description
The 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.
Usage
momentum_aggregate(df = NULL, f = mean, ...)
Arguments
df |
(required, data frame) Output of |
f |
(optional, function) Function to summarize psi scores (for example, |
... |
(optional, arguments of |
Value
data frame
See Also
Other momentum_support:
momentum_boxplot()
,
momentum_model_frame()
,
momentum_spatial()
,
momentum_stats()
,
momentum_to_wide()
Examples
#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