pflm.fpca.FunctionalPCAMuCovParams#

class FunctionalPCAMuCovParams(bw_mu: float | None = None, bw_cov: float | None = None, estimate_method: Literal['smooth', 'cross-sectional'] = 'smooth', kernel_type: KernelType = KernelType.EPANECHNIKOV, method_select_mu_bw: Literal['cv', 'gcv'] = 'gcv', method_select_cov_bw: Literal['cv', 'gcv'] = 'gcv', apply_geo_avg_cov_bw: bool = False, cv_folds_mu: int = 10, cv_folds_cov: int = 10, random_seed: int | None = None)[source][source]#

Bases: object

Parameters for mean and covariance functions in Functional PCA.

Parameters:
bw_mufloat, optional

Bandwidth for the mean function. If None, it will be estimated.

bw_covfloat, optional

Bandwidth for the covariance function. If None, it will be estimated.

estimate_method{‘smooth’, ‘cross-sectional’}, default=’smooth’

Method to estimate the mean and covariance functions.

kernel_typeKernelType, default=KernelType.EPANECHNIKOV

Type of kernel to use for smoothing.

method_select_mu_bw{‘cv’, ‘gcv’}, default=’gcv’

Method to select bandwidth for the mean function.

method_select_cov_bw{‘cv’, ‘gcv’}, default=’gcv’

Method to select bandwidth for the covariance function.

apply_geo_avg_cov_bwbool, default=False

Whether to apply geometric averaging when selecting covariance bandwidth.

cv_folds_muint, default=10

Number of folds for cross-validation when selecting bandwidth for the mean function.

cv_folds_covint, default=10

Number of folds for cross-validation when selecting bandwidth for the covariance function.

random_seedint, optional

Random seed for reproducibility which is used only in CV. If None, no seed is set.

Examples

Default configuration with automatic bandwidth selection:

>>> from pflm.fpca import FunctionalPCAMuCovParams
>>> params = FunctionalPCAMuCovParams()

Fix bandwidths manually:

>>> params = FunctionalPCAMuCovParams(bw_mu=0.5, bw_cov=0.8)

Use cross-validation for bandwidth selection:

>>> params = FunctionalPCAMuCovParams(
...     method_select_mu_bw='cv', method_select_cov_bw='cv',
...     cv_folds_mu=5, cv_folds_cov=5, random_seed=42,
... )