Description Usage Arguments Details Value Author(s) See Also Examples
Estimates mu, A, B and lambda in the harmonic regression, y(t)=mu+A*cos(2*pi*lambda*t)+B*sin(2*pi*lambda*t)+e(t), where e(t) is assumed NID mean zero and constant variance. The default algorithm is enumerative.
1 2 |
z |
series. |
t |
Time points. |
K |
number of subintervals. |
ncpu |
number of compute nodes for use with parallel. |
lambdaRange |
range of frequencies inside (0,0.5), see Details. |
exactQ, |
default setting is FALSE. It indicates whether nolinear optimizer is used to obtain the final estimate of the frequency. |
The QR decomposition is used to efficiently compute the residual
sum of squares on the grid. When exactQ=TRUE
, a NLS
algorithm is used and NLS is indicated in the output title.
list with the following components
coefficients const, A, B, lambda
residuals
periodogram
z
t
K
model
lambdaRange
Yuanhao Lai and A.I. McLeod
1 2 3 4 5 6 7 8 9 10 11 | z<-c(0.42, 0.89, 1.44, 1.98, 2.21, 2.04, 0.82, 0.62, 0.56, 0.8, 1.33)
fitHRegLS(z)
#
#on multicore pcs, more the package parallel may be used for the
#grid computation but unless n is very large this is not recommended.
## Not run: #adjust ncpu
system.time(ans1 <- fitHRegLS(z)) #0.06 sec on my computer
system.time(ans2 <- fitHRegLS(z, ncpu=8)) #1.67 sec
identical(ans1, ans2)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.