rugarch intraday plot ugarchroll

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

rugarch intraday plot ugarchroll

Владимир Иванов
Hey Alexios and fellow R users,
 
I tried plotting the ugarchroll result when using intraday data and it didnt plot anything. However, if we substitute as.Date with as.POSIXct, everything works like charm:
 
in rugarch-plots.r file:
 
# rolling sigma forecast comparison plot
plot_sigma = function(x, VaR.alpha = 0.01, density.support = c(-0.15, 0.15), ...) {
    density = x@forecast$density
    plot(as.POSIXct(rownames(density)), abs(density[, 6]), type = "l", col = "grey",
       main = paste("Sigma Forecast vs |Series|", sep = ""),
       ylab = "", xlab = "", cex.main = 0.7, cex.axis = 0.8, cex.lab = 0.9)
    lines(as.POSIXct(rownames(density)), abs(density[, 2]), col = "steelblue", lwd = 1.5)
    grid()
    invisible(x)
}
 
# rolling series forecast comparison plot
plot_mu = function(x, VaR.alpha = 0.01, density.support = c(-0.15, 0.15), ...) {
    density = x@forecast$density
    plot(as.POSIXct(rownames(density)), density[, 6], type = "l", col = "grey",
       main = paste("Series Forecast vs Realized", sep = ""),
       ylab = "", xlab = "", cex.main = 0.7, cex.axis = 0.8, cex.lab = 0.9)
    lines(as.POSIXct(rownames(density)), (density[, 1]), col = "tomato1", lwd = 1.5)
    grid()
    invisible(x)
}
 
best
Vladimir

_______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: rugarch intraday plot ugarchroll

Frank-2
I have
 
pdf("V0_SPY_Scatter_Plot.pdf")
 
before I do my labels and plotting.
 
Best,
 
Frank
Chicago

 

 

From: R-SIG-Finance <[hidden email]> On Behalf Of ???????? ??????
Sent: Tuesday, December 04, 2018 3:34 AM
To: r-sig-finance <[hidden email]>
Subject: [R-SIG-Finance] rugarch intraday plot ugarchroll

 

Hey Alexios and fellow R users,

 

I tried plotting the ugarchroll result when using intraday data and it didnt plot anything. However, if we substitute as.Date with as.POSIXct, everything works like charm:

 

in rugarch-plots.r file:

 

# rolling sigma forecast comparison plot

plot_sigma = function(x, VaR.alpha = 0.01, density.support = c(-0.15, 0.15), ...) {

    density = x@forecast$density

    plot(as.POSIXct(rownames(density)), abs(density[, 6]), type = "l", col = "grey",

       main = paste("Sigma Forecast vs |Series|", sep = ""),

       ylab = "", xlab = "", cex.main = 0.7, cex.axis = 0.8, cex.lab = 0.9)

    lines(as.POSIXct(rownames(density)), abs(density[, 2]), col = "steelblue", lwd = 1.5)

    grid()

    invisible(x)

}

 

# rolling series forecast comparison plot

plot_mu = function(x, VaR.alpha = 0.01, density.support = c(-0.15, 0.15), ...) {

    density = x@forecast$density

    plot(as.POSIXct(rownames(density)), density[, 6], type = "l", col = "grey",

       main = paste("Series Forecast vs Realized", sep = ""),

       ylab = "", xlab = "", cex.main = 0.7, cex.axis = 0.8, cex.lab = 0.9)

    lines(as.POSIXct(rownames(density)), (density[, 1]), col = "tomato1", lwd = 1.5)

    grid()

    invisible(x)

}

 

best

Vladimir


        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] 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.