Description Usage Arguments Value Author(s) See Also Examples
Return predicted values of the
semiparametric harmonic regression with GAM.
The prediction procedure utilizes the function predict.scair
in the package scar
.
1 2 |
object |
An object of class "semihregScair". |
newt |
A vector of sampled time points for predicted values. |
... |
Other parameters to be passed through to predicting functions. |
A matrix of two column, where the first column contains the sample time points and the second column contains the corresponding predicted values.
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 | # 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
# Fit the semi-harmonic regression
fit1 <- semihregScair(y,t,lambda0=lambda0,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.