Learn R Programming

fmi (version 0.1.7)

determine_npc: Determine Number of FPCs Automatically

Description

Determines the number of functional principal components (FPCs) required to meet a target Proportion of Variance Explained (PVE).

Usage

determine_npc(Y_mat, argvals, target_pve = 0.95, max_npc = 6L)

Value

A list containing:

npc

The selected number of components.

pooled_fpca

The fpca.sc object from the refund package.

scree

A tibble with PVE and cumulative PVE for each component.

Arguments

Y_mat

A numeric matrix (N x M) where N is subjects, M is time points.

argvals

A numeric vector of length M listing the observation points.

target_pve

The target cumulative PVE to reach (default: 0.95).

max_npc

The maximum number of components to retain (default: 6L).

Examples

Run this code
# \donttest{
  sim <- simulate_fmi_data(N_A = 20, N_B = 20, T_points = 30)
  npc_info <- determine_npc(sim$Y_mat, sim$argvals)
  print(npc_info$npc)
# }

Run the code above in your browser using DataLab