generateFMM {FMM} | R Documentation |
Simulating data from FMM models
Description
generateFMM()
simulates data from a FMM model defined by parameters M
, A
, \alpha
, \beta
and \omega
.
Usage
generateFMM(
M,
A,
alpha,
beta,
omega,
from = 0,
to = 2 * pi,
length.out = 200,
plot = TRUE,
outvalues = TRUE,
sigmaNoise = 0
)
Arguments
M |
A numeric vector which contains the value of the intercept parameter |
A |
A positive numeric vector which contains the value of the FMM wave amplitude parameter |
alpha |
A numeric vector which contains the value of the FMM wave phase translation parameter |
beta |
A numeric vector which contains the value of the FMM wave skewness parameter |
omega |
A numeric vector which contains the value of the FMM wave kurtosis parameter |
from |
A numeric value which contains the initial time point of the simulated data. By default, it is 0. |
to |
A numeric value which contains the final time point of the simulated data. By default, it is |
length.out |
A non-negative number wich contains the desired length of the simulation. By default, it is 100. |
plot |
A logical value indicating whether the simulated data should be drawn on a plot. By default, it is |
outvalues |
A logical value indicating whether the numerical simulation should be return. By default, it is |
sigmaNoise |
A non-negative number which contains the standard deviation of the gaussian noise to be added. Its default value is zero equivalent to a simulation set-up without noise. |
Details
To simulate a multicomponent FMM model, arguments A
, alpha
, beta
and omega
are vectors of length m
, where m
represents the number of FMM waves. With different lengths, the smaller vectors will be replicate until thay are the same length as the longest vector.
With sigmaNoise = s
, s>0
, the generateFMM
function uses rnorm(length.out, 0, sigmaNoise)
to create the normally distributed noise and adds it to the simulated values.
Value
When outvalues = TRUE
a list of with the following components is returned:
input |
a list with the input parameters |
t |
a numeric vector with the time points at each data is simulated. |
y |
a numeric vector with the data simulated. |
When plot = TRUE
a scatter plot of y
vs t
is drawn.
References
Rueda C, Larriba Y, Peddada SD (2019). Frequency Modulated Moebius Model Accurately Predicts Rhythmic Signals in Biological and Physical Sciences. Scientific reports, 9 (1), 18701. https://www.nature.com/articles/s41598-019-54569-1
Examples
# Simulate data from a monocomponent FMM model. A plot with the simulated model is shown
generateFMM(M = 2,A = 3,alpha = 1.5,beta = 2.3, omega = 0.1, outvalues = FALSE)
# Add a gaussian noise with standard deviation 0.3. The numeric results are returned
generateFMM(M = 2, A = 3, alpha = 1.5, beta = 2.3, omega = 0.1,
sigmaNoise = 0.3, plot = FALSE, outvalues = TRUE)
# Simulate data from a multicomponent FMM model with two FMM waves
# both with amplitude parameter = 2
generateFMM(M = 0, A = rep(2, 2), alpha = c(1.5, 3.4), beta = c(0.2, 2.3), omega = c(0.1, 0.2))