Hi all,
I seek enlightenment.
I am beginning to study rugarch, to get a better sense of what it can do.
The data I am tying first is tick data for futures contracts, but I suppose
any tick data will have similar issues.
Here is how I am setting up my data:
x = read.table("quotes_M11.dat", header = FALSE, sep="\t", skip=0)
dt<-sprintf("%s %04d",x$V2,x$V4)
dt<-as.POSIXlt(dt,format="%Y-%m-%d %H%M")
y <- data.frame(dt,x$V5)
colnames(y) <- c("tickdate","price")
z <- xts(y[,2],y[,1])
alpha <- to.minutes(z, OHLC=TRUE)
colnames(alpha) <- c("Open","High","Low","Close")
So, x has the raw tick data. NB: I can get the same data, with the same
structure, using SQL from my DB, but didn't want to complicate things. This
data file has but a small subsample of all the data I can work with.
dt gets the date and time data into a single field, as a datetime object
that to.minutes will accept.
y gets a data.frame in which the first column is the datetime and the second
is the price, and z gets an xts object from that.
Finally, alpha gets one minute OHLC data. Not surprisingly, alpha does not
have values for every minute of every day for which there is data in
quotes_M11.dat
I use alpha successfully for an analysis I do using rollapply. That works
great, and it doesn't seem to care that there are minutes without values.
(I don't know that package well enough to know why, so a little
enlightenment would be great).
The problem I have is this.
spec = ugarchspec(variance.model = list(model = "eGARCH", garchOrder = c(1,
1)), mean.model = list(armaOrder = c(1, 1), arfima = FALSE),
distribution.model = "std")
fit = ugarchfit(spec = spec, data = alpha$Close, out.sample = 0, solver =
"solnp", solver.control = list(trace = 0))
Error in if (all(dte[, i] <= 12)) m = i :
missing value where TRUE/FALSE needed
In addition: There were 50 or more warnings (use warnings() to see the first
50)
My reaction to this is, well of course there's missing values. The warnings
are about NAs being produced (In FUN(newX[, i], ...) : NAs introduced by
coercion).
So, I understand the error message and why it happens. The question is,
"What can I do about it?"
Are any of the steps I show in my data manipulation unnecessary? (I expect
that they can be condensed into fewer statements, but I like to see
precisely what each step does before I condense the code.)
Is there another step in my data manipulation that I need to add?
Can any of the methods in the rugarch handle raw tick data directly?
As an aside, I saw mention of rmgarch in the documentation, but when I
select "Install packages" from the Packages submenu, I do not see it listed.
Is it not yet available? If so, is rgarch the principle alternative for
multivariate analyses (and if so, with what caveats)?
Any enlightenment beyond what I found in the manual would be greatly
appreciated.
Thanks
Ted
[[alternative HTML version deleted]]
_______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should
go.