Description Usage Arguments Details Value Author(s) Examples
Conduct an estimation for the frequency parameter and the phase parmeter in the semiparametric harmonic regression model.
1 2 |
z |
A vector or a matrix containg series as columns. |
t |
A vector of sampled time points. |
lambdaRange |
A vector containing candidate frequencies. |
phiRange |
A bector containing candidate phases/2pi. |
InvPI |
A boolean value indicate whether the inverse parabolic interpolation should be used for the final estimated frequency. |
Exact |
Default is TRUE. which indicates that the optimization is performed by enumerating all the combinations of given candidate parameters; FALSE indicates that the optim() funtion is used with the 'Brent' algorithm to find the optimal phi given all enumerated frequencies within lambdaRange. This latter appoarch is efficient for a single series. Notice that directly applying nonlinear optimizer on both lambda and phi easily gets trapped in a local optimal. |
Let z_t,\ (t=1,\cdots,n) be a series from,
z_{t}=g(\cos(2π λ t+φ))+ε_{t},\ t=1,…,n,
where 0<λ<0.5, 0≤φ<2π, and ε_{t}'s are from indenpendent identical distributions.
The estimated frequency and phase are obtained by maximizing the standardized Spearman's rank covariance between the observed series and the fitted series with respect to the parameters λ and φ.
Vector of length 3 containing the maximal standardized Spearman's rank covariance, the estimated frequency and the estimated phase/2pi.
Yuanhao Lai
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | # Simulate the harmonic regression model with standard Gaussian error terms
set.seed(193)
lambdaR <- seq(0.1,0.45,length.out=50)
z <- shreg(15, f=2.5/15, hpar=list(snr=2,zeta=2*pi*0.3), model="Gaussian")
ptestReg(z,method = "LS")$freq #Normal likelihood ratio test
ptestg(z)$freq
GetFitRankLS(z,t=1:15,lambdaRange=lambdaR)
## Finalize the frequency estimate with inverse parabolic interpolation
GetFitRankLS(z,t=1:15,lambdaRange=lambdaR,InvPI=TRUE) # Same result
GetFitRankLS(z,t=1:15,lambdaRange=lambdaR,InvPI=FALSE,Exact=FALSE)
#Simulate the extreme case with Cauchy errors
set.seed(193)
n <- 100
t <- 1:n
z <- cos(2*pi*0.21*t+2*pi*0.3)+rcauchy(n)
ptestReg(z,method = "LS")$freq #Normal likelihood ratio test
ptestg(z)$freq
GetFitRankLS(z,t=1:n,lambdaRange=lambdaR)
## Finalize the frequency estimate with inverse parabolic interpolation
GetFitRankLS(z,t=1:n,lambdaRange=lambdaR,InvPI=TRUE) # Same result
GetFitRankLS(z,t=1:n,lambdaRange=lambdaR,InvPI=FALSE,Exact=FALSE)
#Apply the estimation on multiple series
data(alpha)
## Eliminate genes with missing observations
alpha.nonNA <- alpha[complete.cases(alpha),]
## Using the multiple option to do the test for all the genes
## Transpose the data set so that each column stands for a gene
alpha.nonNA <- t(alpha.nonNA)
n <- nrow(alpha.nonNA)
result <- GetFitRankLS(alpha.nonNA[,1:5],t=1:n,lambdaRange=lambdaR,Exact=FALSE)
result
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.