generate_indices {ehymet}R Documentation

Create a dataset with indices from a functional dataset in one or multiple dimensions

Description

Create a dataset with indices from a functional dataset in one or multiple dimensions

Usage

generate_indices(
  curves,
  k,
  bs = "cr",
  indices = c("EI", "HI", "MEI", "MHI"),
  n_cores = 1,
  ...
)

Arguments

curves

matrix with dimension n \times p in the case of a one-dimensional functional dataset, or array of dimension n \times p \times q in the case of a multivariate functional dataset. n represents the number of curves, p the number of values along the curve, and in the second case, q is the number of dimensions.

k

Number of basis functions for the B-splines. If equals to 0, the number of basis functions will be automatically selected.

bs

A two letter character string indicating the (penalized) smoothing basis to use. See smooth.terms.

indices

Set of indices to be applied to the dataset. They should be any between EI, HI, MEI and MHI.

n_cores

Number of cores to do parallel computation. 1 by default, which mean no parallel execution. Must be an integer number greater than 1.

...

Additional arguments for tfb. See tfb.

Value

A dataframe containing the indices provided in indices for original data, first and second derivatives

Examples

# 3-dimensional array
x1 <- array(c(1, 2, 3, 3, 2, 1, 5, 2, 3, 9, 8, 7, -1, -5, -6, 2, 3, 0, -1, 0, 2, -1, -2, 0),
  dim = c(3, 4, 2)
)
generate_indices(x1, k = 4)

# matrix
x2 <- matrix(c(1, 2, 3, 3, 2, 1, 5, 2, 3, 9, 8, 7), nrow = 3, ncol = 4)
generate_indices(x2, k = 4)

# using additional parameter for tf::tfb
curves <- sim_model_ex1(n = 10)
generate_indices(
  curves = curves,
  k = 20,
  bs = "bs",
  m = c(3,2),        # additional parameter for tfb
  penalized = FALSE  # additional parameter for tfb
)


[Package ehymet version 0.1.1 Index]