Skip to contents

Utilities for tf_mv objects (see tfd_mv() / tfb_mv()). tf_ncomp() returns the number of output dimensions \(d\), tf_components() the list of the d underlying univariate tf vectors, and tf_component() extracts or replaces a single one (also available via the $ operator, e.g. f$x).

Usage

tf_ncomp(f)

tf_components(f)

tf_component(f, which)

tf_component(f, which) <- value

Arguments

f

a tf_mv object.

which

a component name or index.

value

a univariate tf vector (replacement) of matching length and domain.

Value

tf_ncomp(): an integer. tf_components(): a named list of tf vectors. tf_component(): a single univariate tf vector.

Details

Most univariate tf verbs also work on tf_mv objects by acting on each component: tf_rebase() (and hence tfd_mv/tfb_mv conversion), tf_derive(), tf_integrate() (definite integrals return an n x d matrix), tf_smooth() and tf_zoom(). Registration (tf_register() / tf_estimate_warps() / tf_warp() / tf_align()) estimates a single, shared time-warp per curve and applies it jointly to every component. The registration signal is, by default, the first component; use ref_component to pick another component (by name/index), "norm" for the pointwise Euclidean norm, or a function mapping the tf_mv to a univariate tf vector.

is.na() flags a curve as missing if any of its components is missing (the union, not the intersection), which also drives the na.rm behaviour of mean() / median() etc.

See also

Examples

f <- tfd_mv(list(x = tf_rgp(3), y = tf_rgp(3)))
tf_ncomp(f)
#> [1] 2
tf_components(f)
#> $x
#> tfd[3]: [0,1] -> [-2.614292,1.656685] based on 51 evaluations each
#> interpolation by tf_approx_linear 
#> 1: ▂▂▃▃▃▄▄▄▅▅▅▆▆▆▆▆▆▇▇▇▇▇▇▇▇▇
#> 2: ▅▆▆▅▅▅▄▄▄▃▃▃▃▃▃▃▃▃▂▁▁▁▁▁▁▁
#> 3: █████▇▇▇▇▇▇▇▇▇▇▇▆▆▆▆▅▅▄▄▄▃
#> 
#> $y
#> tfd[3]: [0,1] -> [-2.029591,1.066542] based on 51 evaluations each
#> interpolation by tf_approx_linear 
#> 1: ▃▄▄▄▅▅▅▆▇▇▇████▇▇▆▅▄▄▃▃▂▂▂
#> 2: ▇▇▇▇████████▇▇▆▆▆▅▅▅▆▆▆▆▆▆
#> 3: ▅▅▅▅▅▅▄▄▃▃▂▂▁▁▁▁▁▁▁▁▁▂▂▃▃▃
#> 
tf_component(f, "y")
#> tfd[3]: [0,1] -> [-2.029591,1.066542] based on 51 evaluations each
#> interpolation by tf_approx_linear 
#> 1: ▃▄▄▄▅▅▅▆▇▇▇████▇▇▆▅▄▄▃▃▂▂▂
#> 2: ▇▇▇▇████████▇▇▆▆▆▅▅▅▆▆▆▆▆▆
#> 3: ▅▅▅▅▅▅▄▄▃▃▂▂▁▁▁▁▁▁▁▁▁▂▂▃▃▃
f$y
#> tfd[3]: [0,1] -> [-2.029591,1.066542] based on 51 evaluations each
#> interpolation by tf_approx_linear 
#> 1: ▃▄▄▄▅▅▅▆▇▇▇████▇▇▆▅▄▄▃▃▂▂▂
#> 2: ▇▇▇▇████████▇▇▆▆▆▅▅▅▆▆▆▆▆▆
#> 3: ▅▅▅▅▅▅▄▄▃▃▂▂▁▁▁▁▁▁▁▁▁▂▂▃▃▃