arfima.whittle.new<-function(series1)
{
#
# Computes Whittle MLE for ARFIMA(0,d,0) models
#
aux <- nlminb(start = 0.25, whittle.loglik.new, lo = 0., up = 0.499, series=series1)$parameters
return(aux)
}
arfima.whittle.new<-function(series1)
{
#
# Computes Whittle MLE for ARFIMA(0,d,0) models
#
aux <- nlminb(start = 0.25, whittle.loglik.new, lo = 0., up = 0.499, series=series1)$parameters
return(aux)
}
whittle.loglik.new<-function(x, series)
{
series <- series - mean(series)
a <- fft(series)
a <- Mod(a)^2
n <- length(series)
a <- a/(2 * pi * n)
m <- n/2
#
#Fourier frequencies
#
w <- (2 * pi * (1:m))/n
#
#Spectral Density:
#
b <- fn.density(w, x)
#
# Calculate sigma^2
#
sigma2 <- (2 * sum(a[1:m]/b))/n
#
# Whittle Log-likelihood
#
loglik <- 2 * pi * (sum(log(b)) + sum(a[1:m]/b)/sigma2)
return(loglik/n + pi * log(sigma2))
}