Displaying 2 results from an estimated 2 matches for "locwhitt_funct".
2008 Jul 26
1
S-PLUS code in R
...peri <- peri[2:(m + 1)]
z <- c(1:m)
freq <- (2 * pi)/len * z
result <- log(sum(freq^(2 * h - 1) * peri)) - (2 * h)/m *
sum(log(freq)
) # cat("H = ", h, "R = ", result, "\n")
drop(result)
}
locwhitt_function(data, h = 0.5, im = 2)
# data -- Time series.
# h -- Starting H value for minimization.
# im -- Use only N/im frequencies where N is length of series.
{
peri <- per(data)
len <- length(data)
return(nlminb(start = h, obj = rfunc, len = len, im =...
2008 Jul 25
0
s-plus in R... simpler code
...peri <- peri[2:(m + 1)]
z <- c(1:m)
freq <- (2 * pi)/len * z
result <- log(sum(freq^(2 * h - 1) * peri)) - (2 * h)/m *
sum(log(freq)
) # cat("H = ", h, "R = ", result, "\n")
drop(result)
}
locwhitt_function(data, h = 0.5, im = 2)
# data -- Time series.
# h -- Starting H value for minimization.
# im -- Use only N/im frequencies where N is length of series.
{
peri <- per(data)
len <- length(data)
return(nlminb(start = h, obj = rfunc, len = len, im =...