Phases of Sine Waves from the Trigonometric Coefficients
phases.Rd
Find the phases ϕk and the amplitudes γk
for k=1, ..., K such that
α0+K∑k=1αkcos{ωkt}+βksin{ωkt}=Cst+K∑k=1γksin{ωk[t−ϕk]}
where ωk=2πk/365.25 and where the coefficients
αk and βk are given in the object
vector.
Arguments
- object
A numeric vector or matrix having suitable names related to the trigonometric basis
tsDesign
, or a numeric matrix having suitable colnames. This object will most often be given by applying thecoef
method for the"rq"
or the"rqTList"
class, see Examples.
Value
An object with S3 class "phasesMatrix"
inheriting
from "matrix"
. This matrix contains the phases
ϕk as its rows. This matrix has as attribute
"amplitude"
another numeric matrix with K rows,
containing the amplitudes γk as its rows. Some
methods are available for the class "phasesMatrix"
such
as print
and autoplot
.
Caution
When a vector is given in object
, it must
be named with suitable element names in order to allow a
reliable extraction of the coefficients αk and
βk. These correspond to the names
"cosj1", "cosj2", ... coefficients for the cosine terms α1, α2, ..., αK
"sinj1", "sinj2", ... coefficients for the sine terms β1, β2, ..., βK
Some other named elements can be present e.g. for the constant or for trend terms: They will be ignored. Similarly when a numeric matrix of coefficients is given the colnames must be as before. The rownames will be re-used as rowanmes for the result.
Examples
Rq <- rqTList(dailyMet = Rennes)
co <- coef(Rq)
phases(co)
#> phi1 phi2 phi3 gamma1 gamma2 gamma3
#> tau=0.50 112 8.45 8.7 7.28 0.902 0.0712
#> tau=0.70 111 1.86 -19.0 7.52 0.851 0.1125
#> tau=0.80 110 1.46 -26.1 7.94 0.836 0.1816
#> tau=0.90 108 3.78 87.3 8.60 0.809 0.2733
#> tau=0.95 106 8.53 84.2 9.10 0.860 0.2651
#> tau=0.97 106 11.74 81.7 9.48 1.046 0.3743
#> tau=0.98 105 12.14 75.5 9.75 1.170 0.3664
#> tau=0.99 105 11.90 75.0 10.03 1.257 0.3670
## for a vector
phases(co[1 , ])
#> phi1 phi2 phi3 gamma1 gamma2 gamma3
#> [1,] 112 8.45 8.7 7.28 0.902 0.0712
## change the order: the result is the same
phases(co[1, sample(1:7, size = 7)])
#> phi1 phi2 phi3 gamma1 gamma2 gamma3
#> [1,] 112 8.45 8.7 7.28 0.902 0.0712
autoplot(phases(co))