library(QRMon) library(SparseMatrixRecommender) library(quantreg) library(magrittr) library(splines) library(ggplot2) library(ExternalParsersHookUp)
This notebook demonstrates the construction of Quantile Regression workflows using natural language commands.
Simple creation:
qrmon <- QRMonUnit( dfTemperatureData )
pipeline <- ToQuantileRegressionWorkflowCode( "use object qrmon; compute quantile regression with 12 knots; show plot", parse = T ) pipeline
res <- eval( expr = ToQuantileRegressionWorkflowCode( "use object qrmon; summarize data; show plot" ) )
ToQuantileRegressionWorkflowCode( "create from dfTemperatureData; compute quantile regression with 12 knots; show plot", parse = F )
qrObj2 <- eval( expr = ToQuantileRegressionWorkflowCode( "create from dfTemperatureData; summarize data; rescale value axis; compute quantile regression with 12 knots; show plot" ) )
ToQuantileRegressionWorkflowCode( "use object qrmon; compute quantile regression with knots 12, interpolation degree 2 and probabilities 0.1 0.5 0.95; show date list plot with date origin 1900-01-01; find outliers", parse = F)
qrmon2 <- eval( expr = ToQuantileRegressionWorkflowCode( "use object qrmon; compute quantile regression with knots 12 and probabilities 0.1 0.5 0.95; show date list plot with date origin 1900-01-01; find outliers", parse = T) )
ToQuantileRegressionWorkflowCode( "create from dfTemperatureData; compute quantile regression with 16 knots and probability 0.5; show date list plot with date origin 1900-01-01; show absolute errors plot; find anomalies by the threshold 5; take pipeline value; ", parse=F)
dfAnomalies <- eval( expr = ToQuantileRegressionWorkflowCode( "create from dfTemperatureData; compute quantile regression with 16 knots and probability 0.5; show date list plot with date origin 1900-01-01; show absolute errors plot; echo text anomalies finding follows; find anomalies by the threshold 5; take pipeline value; ") )
Plot the data (dfTemperatureData
) and the found anomalies:
(QRMonUnit(dfTemperatureData) %>% QRMonPlot(echoQ = FALSE, datePlotQ = TRUE, dateOrigin = "1900-01-01") %>% QRMonTakeValue) + ggplot2::geom_point( data = dfAnomalies, ggplot2::aes( x = as.POSIXct(Regressor, origin = "1900-01-01"), y = Value ), color = "red" )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.