FMM-internal function

Internal functions for the 'FMM' package.

Internal functions for the 'FMM' package.

The 'FMM' package contains several internal functions called by other functions that are not designed to be called by the user.

To fit a 'FMM' model: The fitting function fitFMM() calls different internal functions for fits in different situations. fitFMM_unit() function fits a monocomponent 'FMM' model and fitFMM_back() fits a multicomponent 'FMM' model via a backfitting algorithm. For restricted version, fitFMM_unit_restr() is used to fit a monocomponent FMM model with fixed omega; fitFMM_restr_omega_beta() and fitFMM_restr() are used to fit multicomponent 'FMM' models with equality constraints for the beta and omega parameters.

To fit a single 'FMM' component: The functions step1FMM(), bestStep1() are used to find the initial parameter estimations and their optimal values in the first step of the fitting process. step2FMM() computes the residual sum of squares in the second step of 'FMM' fitting process. In the restricted version, this function is called step2FMM_restr(). In addition, stepOmega() function is used in an extra optimization step of omega.

To check the convergence criterion for the backfitting algorithm: alwaysFalse() is used to force a number of iterations while R2() is used to check if the stop condition, based on the difference between the variability explained in two consecutive iterations, is reached.

Additional functions: The functions PV(), PVj(), angularMean() and calculateCosPhi() are used in the fitting process to compute the total percentage of variability explained, the percentage of variability explained by each component of 'FMM' model, the angular mean and the cosinus of each of the waves phase,respectively. seqTimes() is used to build a sequence of equally time points spaced in range [0,2π][0, 2\pi]. getApply() serves to prepare the parallelized estimation procedure.

Details

These are not to be called directly by the user.

Returns

Depending on the returned value:

  • fitFMM_unit(), fitFMM_back(), fitFMM_unit_restr(), fitFMM_restr_omegaBeta(), backFittingRestr() and fitFMM_restr()

    return an S4 object of class 'FMM'.

  • iterateOmegaGrid() returns a list with S4 objects of class FMM.

  • step1FMM() and bestStep1() return a numerical vector with the initial parameter estimations and residual sum of squares, respectively. PVj() returns a vector with the percentage of variability explained by each component of 'FMM' model. seqTime() returns a numerical vector with a sequence of equally time points spaced in range [0,2*pi].

  • step2FMM(), step2FMM_restr() and stepOmega() return a numerical value with residual sum of squares of a possible solution. PV() returns the total percentage of variability explained by the model. angularMean() returns the angular mean of the input angles.

  • R2() and alwaysFalse() return a logical value. alwaysFalse() always returns FALSE while R2() returns TRUE when the convergence criterion is reached.

  • Maintainer: Itziar Fernandez
  • License: GPL (>= 2)
  • Last published: 2025-03-01