[R] Could you manually replicate execution of a R function

2023-09-19 Thread Brian Smith
Hi, I have trying to replicate a function from rugarch package manually. Below is the calculation based on the function, library(rugarch) data(dji30ret) spec = ugarchspec(mean.model = list(armaOrder = c(1,1), include.mean = TRUE), variance.model = list(model = "gjrGARCH"), distribution.model =

Re: [R] overlay shaded area in base r plot

2023-09-19 Thread Marc Girondot via R-help
Dear Ani, A solution using my CRAN package HelpersMG; note that yellow is a difficult color to manage correct overlay. It is easier to use red. mean1 <- c(122.194495954369, 118.955256282505, 115.540991140893, 113.116216840647,   111.24053267553, 109.827890459103, 108.523652505026,

Re: [R] overlay shaded area in base r plot

2023-09-19 Thread ani jaya
Thank you very much for the solution. Absolutely will try this to see which one produces better plot. On Tue, Sep 19, 2023, 18:17 Jan van der Laan wrote: > Shorter/simpler alternative for adding a alpha channel > > adjustcolor("lightblue", alpha = 0.5) > > > So I would use something like: > > >

Re: [R] overlay shaded area in base r plot

2023-09-19 Thread Jan van der Laan
Shorter/simpler alternative for adding a alpha channel adjustcolor("lightblue", alpha = 0.5) So I would use something like: # Open new plot; make sure limits are ok; but don't plot plot(0, 0, xlim=c(1,20), ylim = range(c(mean1+sd1, mean2+sd2, mean1-sd1, mean2-sd2)), type="n", las=1,

Re: [R] overlay shaded area in base r plot

2023-09-19 Thread ani jaya
Thank you very much for the help. Turn out I can use 'density' to differentiate the overlaid area. On Tue, Sep 19, 2023, 16:16 Ivan Krylov wrote: > В Tue, 19 Sep 2023 13:21:08 +0900 > ani jaya пишет: > > > > polygon(c(1:20,20:1),c(mean1[1:20]+sd1[1:20],mean1[20:1]),col="lightblue") > > >

Re: [R] overlay shaded area in base r plot

2023-09-19 Thread Ivan Krylov
В Tue, 19 Sep 2023 13:21:08 +0900 ani jaya пишет: > polygon(c(1:20,20:1),c(mean1[1:20]+sd1[1:20],mean1[20:1]),col="lightblue") > polygon(c(1:20,20:1),c(mean1[1:20]-sd1[1:20],mean1[20:1]),col="lightblue") > polygon(c(1:20,20:1),c(mean2[1:20]+sd2[1:20],mean2[20:1]),col="lightyellow") >