| Title: | A Button-Based GUI for Financial and Economic Data Analysis |
|---|---|
| Description: | A GUI designed to support the analysis of financial-economic time series data. |
| Authors: | Ho Tsung-wu [aut, cre] |
| Maintainer: | Ho Tsung-wu <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 1.6.1 |
| Built: | 2026-05-15 05:41:44 UTC |
| Source: | https://github.com/cran/iClick |
A Output GUI designed to simplfy the use of R packages and functions by clicking.
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University
Maintainer: Ho Tsung-wu <[email protected]>
This function generates plot by iClick.VisOneReturns.
boxPlotX(X, col = "indianred2", title = TRUE)boxPlotX(X, col = "indianred2", title = TRUE)
X |
A timeSeries object, single time series returns. |
col |
String for color. |
title |
Whether to generate title of graph. |
This function is an internal function of iClick GUI, which is executed on iClick.VisOneReturns GUI.
Plot a graph
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University
Functions in fBasics.
This function generates calendar heatmap plot up to six year, due to visibility.
calendar.heat(data, ncolors = 99, color = "r2b", date.form = "%Y-%m-%d", main = NULL)calendar.heat(data, ncolors = 99, color = "r2b", date.form = "%Y-%m-%d", main = NULL)
data |
Daily data of price or others. |
ncolors |
Number of color for heatmap. |
color |
Color plate selected, selection includes c("r2b","r2g","w2b"). |
date.form |
Default date form. |
main |
main label of graph. |
This function is within the iClick GUI, is executed within iClick.VisAssetPrice().
Plot
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University
This function generates plot by iClick.VisOneReturns().
cumulatedPlotX(x, index = 100, labels = TRUE, type = "l", col = "indianred2", ylab = "Values", title = TRUE, grid = TRUE, box = TRUE, rug = TRUE)cumulatedPlotX(x, index = 100, labels = TRUE, type = "l", col = "indianred2", ylab = "Values", title = TRUE, grid = TRUE, box = TRUE, rug = TRUE)
x |
A timeSeries object, single time series returns. |
index |
Returns index. |
labels |
Whether to generate label for the graph. |
type |
Type of graph. |
col |
Options for color. |
ylab |
String label for Y axis. |
title |
Whether to generate title for the graph. |
grid |
Whether to use grid in plot. |
box |
Whether to put the plot into a box. |
rug |
Whether to add rug. |
This function is an internal function of iClick GUI, which is executed on iClick.VisOneReturns GUI.
Plot
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University
This function calls cut() to cut tiimeseries into several equal periods and plots over time.
cutAndStack(x, number, overlap = 0.1, type = c("l","g"), xlab = "Time", ylab = deparse(substitute(x)))cutAndStack(x, number, overlap = 0.1, type = c("l","g"), xlab = "Time", ylab = deparse(substitute(x)))
x |
A timeSeries object, single time series price. |
number |
Number of equal cut. |
overlap |
Percentage of overlapping across cuts. |
type |
Type of line. |
xlab |
Label of X axis. |
ylab |
Label of Y axis. |
This function is within the iClick GUI, is executed within iClick.VisAssetprice().
Plot
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University
assetReturns contains DJ component stocks returns data. world20 contains index returns of 20 countries.
data(assetReturns) data(world20)data(assetReturns) data(world20)
assetReturns is a time series object of package xts.
world20 is index returns time series data.
This function is within the iClick GUI, is executed within iClick.VisOneReturns(dat), the data frame dat has two columns, the first column is date index and the second one is numeric time series data.
drawdownPlotX(x, labels = TRUE, type = "l", col = "darkgreen", title = TRUE, ylab = "Down returns", grid = TRUE, box = TRUE, rug = TRUE)drawdownPlotX(x, labels = TRUE, type = "l", col = "darkgreen", title = TRUE, ylab = "Down returns", grid = TRUE, box = TRUE, rug = TRUE)
x |
A timeSeries object, single time series returns. |
labels |
Whether to generate label for the graph. |
type |
Type of line. |
col |
Options for color. |
title |
Whether to generate title for the graph. |
ylab |
String for Y axis. |
grid |
Whether to use grid in plot. |
box |
Whether to put the plot into a box. |
rug |
Whether to add rug. |
This function is an internal function of iClick GUI, which is executed on iClick.VisOneReturns GUI.
Plot
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University
Functions in fBasics.
This function is within the iClick GUI, is executed within iClick.VisOneReturns(dat), the data frame dat has two columns, the first column is date index and the second one is numeric time series data.
drawupPlotX(x, labels = TRUE, type = "l", col = "indianred2", title = TRUE, ylab = "Up Returns", grid = TRUE, box = TRUE, rug = TRUE)drawupPlotX(x, labels = TRUE, type = "l", col = "indianred2", title = TRUE, ylab = "Up Returns", grid = TRUE, box = TRUE, rug = TRUE)
x |
A timeSeries object, single time series returns. |
labels |
Whether to generate label for the graph. |
type |
Type of line. |
col |
Options for color. |
title |
Whether to generate title for the graph. |
ylab |
String for Y axis. |
grid |
Whether to use grid in plot. |
box |
Whether to put the plot into a box. |
rug |
Whether to add rug. |
This function is an internal function of iClick GUI, which is executed on iClick.VisOneReturns GUI.
Plot
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University
Functions in fBasic and fAssets.
This function calculates drawup returns for plotting.
drawups(x)drawups(x)
x |
A timeSeries object, single time series returns. |
This function is an internal function for drawplot of iClick GUI, which is executed on iClick.VisOneReturns GUI.
Returns of draw up periods.
Ho Tsung-wu <[email protected]>
It downloads Download 5-second financial index from the Taiwan Stock Exchange.
getTWSE.fiveSecond(ymd=NULL,skip=2,index.names=NULL)getTWSE.fiveSecond(ymd=NULL,skip=2,index.names=NULL)
ymd |
The year-month-day format of data retrived, for example, "2022-05-03". If unspecified, the default is the Sys.date(); if Saturday, it moves back to Friday; if Sunday, it moves to Monday. |
skip |
The rows to skip, since the web usually contains empty space or notes in the beginning, currently, skip 2 lines is OK, however, it skipped 1. Therefore, the parameter can be checked if it changes again. |
index.names |
The colnames (names of index price) of the dataset are originally in Chinese characters, to avoid language problem, we changed it to V1~V34. Users may offer your own colnames here. |
This function connects with <"https://www.twse.com.tw/exchangeReport/MI_5MINS_INDEX"> and downloads the specified market data. The rownames of downloaded data embeds the timestamp already.
data |
The data retrieved. |
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
#getTWSE.fiveSecond(ymd="2022-05-03",skip=2,index.names=NULL)$data#getTWSE.fiveSecond(ymd="2022-05-03",skip=2,index.names=NULL)$data
This GUI estimates ARIMA both with automatic lag selection and fixed lag length. The GUI is only only a GUI, but also a output format.
iClick.ARIMA(dat, AR = 1, MA = 1, n.ahead = 24, ic = "aic")iClick.ARIMA(dat, AR = 1, MA = 1, n.ahead = 24, ic = "aic")
dat |
Time series object, xts. |
AR |
Pre-specified fixed AR order. |
MA |
Pre-specified fixed MA order. |
n.ahead |
Periods of out-of-sample forecast. |
ic |
Information criteria for lag selection,ic=c("aicc", "aic", "bic"). See auto.arima() of package forecast. |
This GUI fits two ARMA, fixed orders and automatically fitted orders, and returns a two-part GUI with output on it. The outputs can be saved as .RData file for later use, the last row is the save button.
The saved filename is automatically generated by selections and results; for example, .aicOrderARIMA_102.RData represents the automatically fits ARIMA(p,d,q) orders are ARIMA(1,0,2) by AIC.
Using load(".aicOrderARIMA_102.RData") to retrieve the file and ls() to list objects, and use names() to show details of objects.
The input returns data must be in percentage form; namely, dlog()*100
Fitted ARMA regression output.
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University
arima() and auto.arima() of package forecast.
## Simulation data dat=rnorm(200) y=ts(dat, end = c(2025, 8), frequency = 12) iClick.ARIMA(y)## Simulation data dat=rnorm(200) y=ts(dat, end = c(2025, 8), frequency = 12) iClick.ARIMA(y)
This GUI makes GARCH estimation of comparison easy. With a pre-selected GARCH type, it automatically fits eight probability distributions and conducts all diagnostic tests with a Click.
iClick.GARCH(dat, meanEQ = meanEQ, garchEQ = garchEQ, n.ahead = 15)iClick.GARCH(dat, meanEQ = meanEQ, garchEQ = garchEQ, n.ahead = 15)
dat |
Time series object, xts. |
meanEQ |
Specification of mean equation. |
garchEQ |
Specification of variance equation. |
n.ahead |
Number of out-of-sample forecasting period. |
This GUI fits 8 distributions for univariate GARCH with pre-selected GARCH types, and returns a 54-button GUI output. The outputs can be individually saved as .RData file for later use, the last row is the save button.The saved filename is automatically generated once clicked, in addition, corresponding .csv files will be generated also.
The 54-button GUI is divided into 9 panes, and the last pane collects coefficient outputs and diagnostic tests together, which aims to make estimation comparison easy.
Fitted GARCH regression output.
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University
library(rugarch)
##==External data data("world20") y=na.omit(diff(log(world20[,1]))) ##== Simulation data #dat=rnorm(200,5,1) #y=ts(dat, start = c(1970, 1), frequency = 12) meanEQ=list(AR=1,MA=0,Exo=NULL, autoFitArma=FALSE,arfimaDiff=FALSE,archM=FALSE) # If there are external regressors X, put them as Exo=X # autoFitArma=TRUE, If you want to fit arma automatically. # arfimaDiff=TRUE,to take ARFIMA difference # archM=TRUE, to estimate GARCH-in-mean garchEQ=list(Type="sGARCH",P=1,Q=1, exo=NULL) # Type: "sGARCH","eGARCH","gjrGARCH","iGARCH","apGARCH" # please check rugarch for details. # P is the ARCH order # Q is the GARCH order #iClick.GARCH(y,meanEQ, garchEQ, n.ahead=15) # This computation takes more than 6 seconds, hence I added a # to block it.##==External data data("world20") y=na.omit(diff(log(world20[,1]))) ##== Simulation data #dat=rnorm(200,5,1) #y=ts(dat, start = c(1970, 1), frequency = 12) meanEQ=list(AR=1,MA=0,Exo=NULL, autoFitArma=FALSE,arfimaDiff=FALSE,archM=FALSE) # If there are external regressors X, put them as Exo=X # autoFitArma=TRUE, If you want to fit arma automatically. # arfimaDiff=TRUE,to take ARFIMA difference # archM=TRUE, to estimate GARCH-in-mean garchEQ=list(Type="sGARCH",P=1,Q=1, exo=NULL) # Type: "sGARCH","eGARCH","gjrGARCH","iGARCH","apGARCH" # please check rugarch for details. # P is the ARCH order # Q is the GARCH order #iClick.GARCH(y,meanEQ, garchEQ, n.ahead=15) # This computation takes more than 6 seconds, hence I added a # to block it.
This GUI estimates ARIMA both with automatic lag selection and fixed lag length. The GUI is only only a GUI, but also a output format.
iClick.lm(dep,indep,data,Formula=NULL,bootrep=99)iClick.lm(dep,indep,data,Formula=NULL,bootrep=99)
data |
A R data object for lm() |
dep |
scalar, the number of column as dependent variable |
indep |
scalar, the numbers of column as independent variables |
Formula |
A formula for lm, default is NULL, if specified, dep and indep should leave empty. See example below |
bootrep |
Bootstrap replications, default is 99 |
This GUI fits equaiton into lm regression.
Fitted lm regression output.
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University
lm()
data("FFplusMOM") iClick.lm(dep=2,indep=c(3,5:6),data=FFplusMOM, bootrep=9) #Eq=RET~(MK_BETA+HML_BETA+SMB_BETA)^2 #iClick.lm(Formula=Eq,data=FFplusMOM, bootrep=9)data("FFplusMOM") iClick.lm(dep=2,indep=c(3,5:6),data=FFplusMOM, bootrep=9) #Eq=RET~(MK_BETA+HML_BETA+SMB_BETA)^2 #iClick.lm(Formula=Eq,data=FFplusMOM, bootrep=9)
This GUI conducts plots of daily asset price, including calendar heatmap and many plots which are not easy to use for new users.
iClick.VisAssetPrice(dat, color4 = "r2b", color5 = "jet")iClick.VisAssetPrice(dat, color4 = "r2b", color5 = "jet")
dat |
Time series object,xts. |
color4 |
Color choice for annual calendar heatmap, the default is "r2b". |
color5 |
Color choice for 6-year calendar heatmap, the default is "jet". |
This GUI is designed for financial time series, maily daily stock price. Other time series data works also, as long as it has a date column. We call function calendarPlot() from package "openair", and modified the function calendarHeat() to fit daily price, which is limited to 11 years.
Output GUI
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University
#data("IBM") #assetPrice=IBM[,1] #iClick.VisAssetPrice(assetPrice)#data("IBM") #assetPrice=IBM[,1] #iClick.VisAssetPrice(assetPrice)
This GUI conducts plots of daily asset returns, including ACF, PACF, drawdowns, and Talyor effects.
iClick.VisOneReturns(dat)iClick.VisOneReturns(dat)
dat |
Time series object,xts. |
This GUI is designed for financial time series, maily daily stock returns. Other time series data works also, as long as it has a date column.
Output GUI
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University
data("world20") y=na.omit(diff(log(world20[,1]))) ## Simulation data #dat=rnorm(200,5,1) #y=ts(dat, start = c(1970, 1), frequency = 12) iClick.VisOneReturns(y)data("world20") y=na.omit(diff(log(world20[,1]))) ## Simulation data #dat=rnorm(200,5,1) #y=ts(dat, start = c(1970, 1), frequency = 12) iClick.VisOneReturns(y)
Start the JFE GUI (graphical user interface)
JFE()JFE()
After loading the package, in the command prompt, type JFE() to start it. JFE is a menu-driven GUI designed to support the analysis of financial time series data with the aid of several R packages. The version 1.1 focuses on: Firstly, price visualization, including technical charting(by package quantmod); secondly, assets selection based on Performance index(by package PerformanceAnalytics); thirdly, portfolio optimization (by package "fPORTFOLIO").
This command is an internal function to start the JFE GUI. To avoid unexpected problems of time series object, the imported data must be time series object (xts, or timeSeries) loaded by either .RData or .rda, file of .csv or other format is not supported; that is to say, users have only to know how to construct a R time-series object.
If execution of All-in-one from backtesting fails, then it is a problem associated with undocumented functions. Please re-install this package from Github via devtools::install_github("tsungwu/JFE"), detailed are also explained in Github and <"http://web.ntnu.edu.tw/~tsungwu/R_DevOps/R_DevOps.htm">.
Generate a menu-driven GUI
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
JFE()JFE()
This function is within the iClick GUI, is executed within iClick.VisOneReturns(dat), the data frame dat has two columns, the first column is date index and the second one is numeric time series data.
qqnormPlotX(X, labels = TRUE, col = "indianred2", pch = 19, title = TRUE, mtext = TRUE, grid = FALSE, rug = TRUE, scale = TRUE)qqnormPlotX(X, labels = TRUE, col = "indianred2", pch = 19, title = TRUE, mtext = TRUE, grid = FALSE, rug = TRUE, scale = TRUE)
X |
A timeSeries object, single time series returns. |
labels |
Whether to generate label for the graph. |
col |
String for color. |
pch |
Line options. |
title |
Whether to generate title for the graph. |
mtext |
Whether to generate main text for the graph. |
grid |
Whether to use grid in plot. |
rug |
Whether to add rug. |
scale |
Whether to scale the data. |
This function is an internal function of iClick GUI, which is executed on iClick.VisOneReturns GUI.
Plot
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University
Functions in fBasics.
It calls FRAPO to compute risk optimal portfolio satisfying the constraint of draw downs and returns a S4 object of class fPORTFOLIO.
riskOptimalPortfolio(data, Type="AveDD",value)riskOptimalPortfolio(data, Type="AveDD",value)
data |
timeSeries object of price data. Please remember the asset data must be price, not returns. |
Type |
Drawdown types, we call package FRAPO to support three methods:"maxDD","aveDD",and "CDaR". For details, please see document of package FRAPO. |
value |
Positive numerical number for Type. |
The risk optimal portfolio calls FRAPO and wrapp the results as a S4 object of class fPORTFOLIO, all get functions of fPORTFOLIO are applicable.
returns an S4 object of class "fPORTFOLIO".
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Roncalli Thierry, Introduction to Risk parity and Budgeting, 2014, CRC inc..
See also packages fPORTFOLIO and FRAPO
# Risk optimal portfolio takes time, example below is commented. data(LPP2005,package="fPortfolio") Data = LPP2005[,1:6]#select 6 assets price Data.RET=timeSeries::returns(Data) # Transform into returns to compute VALUE below #VALUE=abs(mean(drawdowns(apply(Data.RET,1,mean)))) #output=riskOptimalPortfolio(Data,Type="AveDD",value=VALUE) # data input must be price. #show(output) #getWeights(output) #getCovRiskBudgets(output)# Risk optimal portfolio takes time, example below is commented. data(LPP2005,package="fPortfolio") Data = LPP2005[,1:6]#select 6 assets price Data.RET=timeSeries::returns(Data) # Transform into returns to compute VALUE below #VALUE=abs(mean(drawdowns(apply(Data.RET,1,mean)))) #output=riskOptimalPortfolio(Data,Type="AveDD",value=VALUE) # data input must be price. #show(output) #getWeights(output) #getCovRiskBudgets(output)
It calls FRAPO to compute portfolio weights with equal risk contribution, or equal covariance risk budget, then returns a S4 object of class fPORTFOLIO.
riskParityPortfolio(data, covmat="cov", strategy="minrisk",Type="MV")riskParityPortfolio(data, covmat="cov", strategy="minrisk",Type="MV")
data |
timeSeries object of returns data |
covmat |
Function to compute mltvariate covariance matrix, we support five methods:"cov","ledoitWolf","shrink","shrinkCC","slpm". The default is sample covariance "cov". |
strategy |
strategyPortfolio as in package fPortfolio, we support 5 cases in fPortfolio package: "GMVP","maxreturn","minrisk", "tangency" and "All Assets". The default is "minrisk". |
Type |
portfolio type as in package fPortfolio, the default is "MV". |
The risk parity portfolio has two options: the first is to select a subset of assets and compute risk parity weights. To this end, we implement one of four portfolio strategies: "GMVP","maxreturn","minrisk", "tangency". The idea is that each portfolio strategy will pick the desirable assets by assigning weights, the assets with non-zero weights are selected ones; afterwards, we compute risk parity weights of these assets. Secondly, for "All Assets", all assets are included and compute an optimal weight vector satisfying risk parity condition,namely, equal risk contribution or covariance risk budget.
GMVP or Global minimum risk Portfolio:
The function minvariancePortfolio returns the portfolio
with the minimal risk on the efficient frontier. To find the
minimal risk point the target risk returned by the function
efficientPortfolio is minimized.
tangency or maximal returns/risk ratio Portfolio:
The function tangencyPortfolio returns the portfolio with
the highest return/risk ratio on the efficient frontier. For the
Markowitz portfolio this is the same as the Sharpe ratio. To find
this point on the frontier the return/risk ratio calculated from
the target return and target risk returned by the function .
minrisk or Minumum Risk:
The function minriskPortfolio is an efficient portfolio which lies on the efficient
frontier. The efficientPortfolio function returns the properties of
the efficient portfolio as an S4 object of class fPORTFOLIO
maxreturn or Maximum Return Portfolio:
The function maxreturnPortfolio returns the portfolio
with the maximal return for a fixed target risk.
Risk parity portfolio calls FRAPO, which requires symmetric covariance matrices, so far we support only five covariance methods.
returns an S4 object of class "fPORTFOLIO".
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University.
Roncalli Thierry, Introduction to Risk parity and Budgeting, 2014, CRC inc..
See also packages fPORTFOLIO and FRAPO
data(assetReturns) assetReturns=assetReturns[,11:15] output=riskParityPortfolio(assetReturns, covmat="cov", strategy="minrisk") show(output) getWeights(output) getCovRiskBudgets(output)data(assetReturns) assetReturns=assetReturns[,11:15] output=riskParityPortfolio(assetReturns, covmat="cov", strategy="minrisk") show(output) getWeights(output) getCovRiskBudgets(output)
This function is within the iClick GUI, is executed within iClick.VisOneReturns(dat), the data frame dat has two columns, the first column is date index and the second one is numeric time series data.
seriesPlotX(x,labels=TRUE,type="l",col="indianred2", ylab="Value", title=TRUE, grid=TRUE, box=TRUE, rug=TRUE)seriesPlotX(x,labels=TRUE,type="l",col="indianred2", ylab="Value", title=TRUE, grid=TRUE, box=TRUE, rug=TRUE)
x |
A timeSeries object, single time series returns. |
labels |
Whether to generate label for the graph. |
type |
Type of graph. |
col |
Options for color. |
ylab |
String label for Y axis. |
title |
Whether to generate title for the graph. |
grid |
Whether to generate grid for the graph. |
box |
Whether to put the plot into a box. |
rug |
Whether to add rug. |
This function is an internal function of iClick GUI, which is executed on iClick.VisOneReturns GUI.
Plot
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University
fBasics
This function tests for mullticolinearity.
VIF_no(obj)VIF_no(obj)
obj |
A lm object |
This function is an internal function of iClick GUI, which is executed on iClick.lm GUI.
Test statistic
Ho Tsung-wu <[email protected]>, College of Management, National Taiwan Normal University