[Yuima-commits] r529 - in pkg/yuimaGUI: . inst/yuimaGUI inst/yuimaGUI/www

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Nov 29 12:38:10 CET 2016


Author: phoenix844
Date: 2016-11-29 12:38:10 +0100 (Tue, 29 Nov 2016)
New Revision: 529

Removed:
   pkg/yuimaGUI/inst/yuimaGUI/www/oviedo2016.png
   pkg/yuimaGUI/inst/yuimaGUI/www/seville2016.png
Modified:
   pkg/yuimaGUI/DESCRIPTION
   pkg/yuimaGUI/inst/yuimaGUI/server.R
   pkg/yuimaGUI/inst/yuimaGUI/ui.R
Log:


Modified: pkg/yuimaGUI/DESCRIPTION
===================================================================
--- pkg/yuimaGUI/DESCRIPTION	2016-11-28 16:19:50 UTC (rev 528)
+++ pkg/yuimaGUI/DESCRIPTION	2016-11-29 11:38:10 UTC (rev 529)
@@ -1,7 +1,7 @@
 Package: yuimaGUI
 Type: Package 
 Title: A Graphical User Interface for the Yuima Package
-Version: 0.9.2
+Version: 0.9.3
 Author: YUIMA Project Team
 Maintainer: Emanuele Guidotti <emanuele.guidotti at studenti.unimi.it>
 Description: Provides a graphical user interface for the yuima package.

Modified: pkg/yuimaGUI/inst/yuimaGUI/server.R
===================================================================
--- pkg/yuimaGUI/inst/yuimaGUI/server.R	2016-11-28 16:19:50 UTC (rev 528)
+++ pkg/yuimaGUI/inst/yuimaGUI/server.R	2016-11-29 11:38:10 UTC (rev 529)
@@ -38,12 +38,12 @@
     HTML('<iframe width="90%" height="250px" src="https://www.youtube.com/embed/XX_bmCrI_gc?rel=0" frameborder="0" allowfullscreen></iframe>')
   })
   
-  output$certificates <- renderUI({
-    div(align = "center",
-      HTML('<div id="certificate1" style="display: inline-block;"><img src="seville2016.png" class="thumbnail" height="100" width="100" /></div>
-            <div style="display: inline-block;"><img src="oviedo2016.png" class="thumbnail" height="100" width="100" /></div>')
-    )
-  })
+  # output$certificates <- renderUI({
+  #   div(align = "center",
+  #     HTML('<div id="certificate1" style="display: inline-block;"><img src="seville2016.png" class="thumbnail" height="100" width="100" /></div>
+  #           <div style="display: inline-block;"><img src="oviedo2016.png" class="thumbnail" height="100" width="100" /></div>')
+  #   )
+  # })
   
   
   ########################Load Economic and Financial Data
@@ -1088,7 +1088,7 @@
     test <- FALSE
     choices <- NULL
     if(length(names(yuimaGUIdata$model))!=0) for (i in names(yuimaGUIdata$model)) for (j in 1:length(yuimaGUIdata$model[[i]])) 
-      if(yuimaGUIdata$model[[i]][[j]]$info$class %in% c("Diffusion process", "Compound Poisson", "Levy process")){
+      if(yuimaGUIdata$model[[i]][[j]]$info$class %in% c("Diffusion process", "Compound Poisson", "Levy process", "COGARCH")){
         test <- TRUE
         choices <- c(choices, paste(i,j))
       }
@@ -1106,7 +1106,9 @@
       id <- unlist(strsplit(input$model_modal_model_id, split = " " , fixed = FALSE))
       type <- isolate({yuimaGUIdata$model})[[id[1]]][[as.numeric(id[2])]]$info$class
       shinyjs::toggle(id = "model_modal_plot_intensity", condition = type %in% c("Compound Poisson", "Levy process"))
+      shinyjs::toggle(id = "model_modal_plot_variance", condition = type %in% c("COGARCH"))
       shinyjs::toggle(id = "model_modal_plot_distr", condition = type %in% c("Diffusion process","Compound Poisson", "Levy process"))
+      shinyjs::toggle(id = "model_modal_plot_test", condition = type %in% c("Diffusion process","Compound Poisson", "Levy process"))
     }
   })
   
@@ -1122,8 +1124,8 @@
           delta <- y$model at sampling@delta
           t <- y$model at sampling@grid[[1]][-length(y$model at sampling@grid[[1]])]
           x <- as.numeric(y$model at data@zoo.data[[1]])
+          dx <- diff(x)
           x <- x[-length(x)]
-          dx <- diff(x)
           for (i in names(y$qmle at coef)) assign(i, value = as.numeric(y$qmle at coef[i]))
           z <- (dx-eval(y$model at model@drift)*delta)/(eval(y$model at model@diffusion[[1]])*sqrt(delta))
           z <- data.frame("V1" = z)
@@ -1148,12 +1150,35 @@
           })
         }
         
-        if (y$info$class=="Compound Poisson" | y$info$class=="Levy process"){
+        else if (y$info$class=="COGARCH"){
+          
+          dx <- diff(y$model at data@original.data[,1])
+          v <- cogarchNoise(y$model, param = as.list(coef(y$qmle)))$Cogarch at original.data[,"v"]
+          v <- v/mean(v)*sd(dx)
+          z <- data.frame("dx" = dx, "vplus" = v[-1], "vminus" = -v[-1], "time" = index(dx))
+          output$model_modal_plot_variance <- renderPlot({
+            return(
+              ggplot(z, aes(x = time)) + 
+                geom_line(aes(y = dx), size = 1, color = "black") +
+                geom_line(aes(y = vplus), size = 1, color = "green") +
+                geom_line(aes(y = vminus), size = 1, color = "green") +
+                scale_color_manual(values=c("black", "green", "green")) +
+                theme(
+                  plot.title = element_text(size=14, face= "bold", hjust = 0.5),
+                  axis.title=element_text(size=12),
+                  legend.position="none"
+                ) +
+                labs(fill="", title = "Estimated VS Sample Volatility", x = "Time", y = "Increments")
+            )
+          })
+        }
+        
+        else if (y$info$class=="Compound Poisson" | y$info$class=="Levy process"){
           threshold <- ifelse(is.na(y$info$threshold), 0, y$info$threshold)          
           x <- as.numeric(y$model at data@zoo.data[[1]])
           dx <- diff(x)
           dx <- dx[abs(dx)>threshold]
-          dx <- dx-sign(dx)*threshold
+          #dx <- dx-sign(dx)*threshold
           for (i in names(y$qmle at coef)) assign(i, value = as.numeric(y$qmle at coef[i]))
           dx <- data.frame("V1" = dx)
           if(y$info$jumps=="Gaussian"){
@@ -1563,8 +1588,10 @@
   output$simulate_nstep <- renderUI({
     if(!is.null(input$simulate_modelID)){
       id <- unlist(strsplit(input$simulate_modelID, split = " "))
-      if (!(isolate({yuimaGUIdata$model[[id[1]]][[as.numeric(id[2])]]$info$class}) %in% c("COGARCH", "CARMA")))
+      if (input$simulate_modelID %in% names(usr_models$simulation))
         numericInput("simulate_nstep", label = "Number of steps per simulation", value = simulateSettings[[input$simulate_modelID]][["nstep"]], min = 1, step = 1)
+      else if (!(isolate({yuimaGUIdata$model[[id[1]]][[as.numeric(id[2])]]$info$class}) %in% c("COGARCH", "CARMA")))
+        numericInput("simulate_nstep", label = "Number of steps per simulation", value = simulateSettings[[input$simulate_modelID]][["nstep"]], min = 1, step = 1)
     }
   })
 
@@ -1689,7 +1716,7 @@
               "simulate.to" = as.numeric(simulateSettings[[modID]][["t1"]]))
             Initial <- simulateSettings[[modID]][["t0"]]
             Terminal <- simulateSettings[[modID]][["t1"]]
-            n <- ifelse(is.na(simulateSettings[[modID]][["nstep"]]),(Terminal-Initial)/0.01,simulateSettings[[modID]][["nstep"]])
+            n <- ifelse(is.na(simulateSettings[[modID]][["nstep"]]),1000,simulateSettings[[modID]][["nstep"]])
             addSimulation(
               modelYuima = setYuima(model = setModelByName(name = info$model, jumps = info$jumps)),
               true.parameter = usr_models$simulation[[modID]][["true.param"]],
@@ -2903,7 +2930,12 @@
               }
             }
             if(input$llag_type=="corr"){
-              res <- try(cce(x = yuimaData, method = input$llag_corr_method))
+              if(input$llag_corr_method %in% c("pearson", "kendall", "spearman")){
+                x <- as.matrix(yuimaData at original.data)
+                res <- try(cor(x, method = input$llag_corr_method, use = "pairwise.complete.obs"))
+              } 
+              else 
+                res <- try(cce(x = yuimaData, method = input$llag_corr_method)$cormat)
               if (class(res)=="try-error")
                 createAlert(session, anchorId = "llag_alert", alertId = "llag_alert_select", content = "Error in computing the correlation matrix", style = "error")
               else {
@@ -2915,7 +2947,7 @@
                     i <- i+1
                   } else break
                 }
-                yuimaGUIdata$llag[[id]] <<- list(type = "corr", covmat = res$covmat, cormat = res$cormat, method = input$llag_corr_method, start = start, end = end)
+                yuimaGUIdata$llag[[id]] <<- list(type = "corr", cormat = res, method = input$llag_corr_method, start = start, end = end)
               }
             }
           } else{

Modified: pkg/yuimaGUI/inst/yuimaGUI/ui.R
===================================================================
--- pkg/yuimaGUI/inst/yuimaGUI/ui.R	2016-11-28 16:19:50 UTC (rev 528)
+++ pkg/yuimaGUI/inst/yuimaGUI/ui.R	2016-11-29 11:38:10 UTC (rev 529)
@@ -61,8 +61,9 @@
         )
       ),
       fluidRow(
-        column(8, br(),
-          uiOutput("certificates")       
+        column(8#, 
+          #br(),
+          #uiOutput("certificates")       
         ),
         column(4,
           h3(em("Developed by"), style="color:#edeeed", align = "center"),
@@ -303,6 +304,7 @@
                     ),
                     fluidRow(
                       column(12, 
+                             plotOutput("model_modal_plot_variance"),
                              plotOutput("model_modal_plot_intensity"),
                              plotOutput("model_modal_plot_distr"),
                              uiOutput("model_modal_plot_test", align = "center")
@@ -845,7 +847,7 @@
           div(align="center",
             selectInput("llag_type", label = "Type of analysis", choices = c("Lead-Lag"="llag", "Correlation"="corr"), selected = "llag"),
             numericInput("llag_maxLag", label = "Max Lag", value = 20, min = 1, step = 1),
-            shinyjs::hidden(selectInput("llag_corr_method", label = "Method", choices = c("Hayashi-Yoshida"="HY", "Pre-averaged Hayashi-Yoshida"="PHY", "Modulated Realized Covariance"="MRC", "Two Scales realized CoVariance"="TSCV", "Generalized Multiscale Estimator"="GME", "Realized Kernel"="RK", "Quasi Maximum Likelihood Estimator"="QMLE", "Separating Information Maximum Likelihood"="SIML", "Truncated Hayashi-Yoshida"="THY", "Pre-averaged Truncated Hayashi-Yoshida"="PTHY", "Subsampled Realized Covariance"="SRC", "Subsampled realized BiPower Covariation"="SBPC"))),
+            shinyjs::hidden(selectInput("llag_corr_method", label = "Method", choices = c("Pearson"="pearson", "Kendall"="kendall", "Spearman"="spearman", "Hayashi-Yoshida"="HY", "Pre-averaged Hayashi-Yoshida"="PHY", "Modulated Realized Covariance"="MRC", "Two Scales realized CoVariance"="TSCV", "Generalized Multiscale Estimator"="GME", "Realized Kernel"="RK", "Quasi Maximum Likelihood Estimator"="QMLE", "Separating Information Maximum Likelihood"="SIML", "Truncated Hayashi-Yoshida"="THY", "Pre-averaged Truncated Hayashi-Yoshida"="PTHY", "Subsampled Realized Covariance"="SRC", "Subsampled realized BiPower Covariation"="SBPC"), selected = "HY")),
             dateRangeInput("llag_range_date", label = "Range", start = Sys.Date()-365, end = Sys.Date()),
             shinyjs::hidden(div(id="llag_range_numeric",
                                 column(6,numericInput("llag_range_numeric1", label = "From", value = 0)),

Deleted: pkg/yuimaGUI/inst/yuimaGUI/www/oviedo2016.png
===================================================================
(Binary files differ)

Deleted: pkg/yuimaGUI/inst/yuimaGUI/www/seville2016.png
===================================================================
(Binary files differ)



More information about the Yuima-commits mailing list