Displaying 3 results from an estimated 3 matches for "maxord".
2012 Feb 28
1
Error in solve.default(res$hessian * n.used) :Lapack routine dgesv: system is exactly singular
...R and I´m using it to run statisc analysis.
With the code for ARIMA below I´m getting this error: Error in
solve.default(res$hessian * n.used) :Lapack routine dgesv: system is
exactly singular
The code is:
> s.ts <- ts(x[,7], start = 2004, fre=12)
> get.best.arima <- function (x.ts, maxord=c(1,1,1,1,1,1))
+ {
+ best.aic <- 1e8
+ n <- length(x.ts)
+ for (p in 0:maxord[1]) for (d in 0:maxord[2]) for (q in 0:maxord[3])
+ for (P in 0:maxord[4]) for (D in 0:maxord[5]) for (Q in 0:maxord[6])
+ {
+ fit <- arima(x.ts, order=c(p,d,q),
+ seas = list(order=c(P,D,Q),
+ frequen...
2006 Nov 25
2
predict and arima
Hi all,
Forecasting from an arima model is easy with predict.
But I can't manage to backcast : invent data from the model before the
begining of the sample.
The theory is easy : take your parameters, reverse your data, forecast, and
then reverse the forecast
I've tried to adapt the predict function to do that (i'm not sure that the
statistical procedure is fine (with the residuals),
2002 Jan 19
1
Synthesis of harmonic functions
...t, ord) {
y <- a0
for (p in ord) {
k <- 2 * pi * p * x/t
y <- y + a[p] * cos(k) + b[p] * sin(k)
}
y
}
harmonic.matrix <- function(x, a0, a, b, n, ord) {
k <- (2 * pi * x/n) %*% t(ord)
y <- a0 + cos(k) %*% a[ord] + sin(k) %*% b[ord]
y
}
n <- 4000
maxord <- n/2
x <- 0:(n-1)
y <- sin(x*2*pi/n) + rnorm(n)*0.1
pf <- fft(y) ## Fast Fourier Transform
a0 <- Re(pf[1])/n
pf <- pf[-1] ## drop first element
a <- 2*Re(pf)/n; b <- -2*Im(pf)/n
y1 <- harmonic.simple(x,a0,a,b,n,1:maxord)
y2 <- harmonic.matr...