Description Usage Arguments Details Value Author(s) References See Also Examples
Fit the semiparametric harmonic regression with monotone
generalzied additive index model by maximizing non-parametric likelihood.
It utilizes the function scair
in the R package scar
.
1 2 |
y |
A vector containg series as columns. |
t |
A vector of sampled time points. |
lambda0 |
The frequency of the harmonic compoenent. |
shape |
The shape constraint for the function g.
See |
family |
a description of the error distribution and link function to be used in the model.
Default is gaussian(). See |
... |
Additional parameters passed to |
Given frequency λ, fit a monotonic single index model with the likelihood method, i.e.,
E[y_t] = μ+g( A\cos(2πλ t)+B\sin(2π λ t) ),\ t=1,...,n,
where y_{t} consists of independet random variables, a_{1}^2+a_{2}^2=1, g(\cdot) is an unknown strictly monotone function in the range [0,1], 0<f<0.5, A^2 + B^2 =1 and σ>0.
This is done by using the R package scar
.
For more details, see scair
in the R package scar
.
Object of class "semihregScair" produced.
An object of class "semihregScair" is a list containing the following components:
harScair |
An object of class |
lambda0 |
The frequency of the harmonic compoenent. |
phi0 |
The estimated phase/2pi of the harmonic compoenent. |
esty |
estimated mean for the observations. |
Yuanhao Lai
Chen, Y. and Samworth, R. J. (2014). Generalised additive and index models with shape constraints. arXiv:1404.2957.
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 34 35 36 | # Simulate the series
set.seed(193)
g <- function(x){-2*exp(-x^3)}
n <- 50
t <- 1:n
lambda0 <- 0.123
phi0 <- 0.2*2*pi
u <- cos(2*pi*lambda0*t+phi0)
e <- rnorm(n)
y <- g(u)+e
# Plot ther series
par(mfrow=c(1,2))
plot(t,g(u),type="b")
plot(t,y,type="b")
par(mfrow=c(1,1))
# Pre-estimate the frequency and the phase
lambdaRange <- seq(1/n,0.5-1/n,length.out = 5*n)
paraRankLS <- GetFitRankLS(y,t=1:n,lambdaRange)
paraRankLS
# Fit the semi-harmonic regression
fit1 <- semihregScair(y,t,lambda0=paraRankLS[2],shape="in",iter=100)
names(fit1)
fit1$esty
# Prediction for the continuous time.
newt <- seq(1,n,0.05)
head( predy <- predict(fit1,newt))
plot(newt,g(cos(2*pi*lambda0*newt+phi0)),
type="b",pch=19,main="Semiparametric with scair",
xlab="t", ylab="g(u)",
ylim=c(min(predy[,2])-1,max(predy[,2])+0.5) )
lines(newt,predy[,2],col="red",type="b")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.