#' fun_PlotsAndAlphaTable_v2
#'
#' @param period Period of which one want to have lagged values of
#' @param tablePeriods Period one want to have lagged values of in xtable. The range is the range of the plot
#' @param savePlot If oen want to save the plot
#' @param listExcess List of excess returns
#' @param outdir Output dir
#' @param namesList List of names
#'
#' @return List\
#' \item{name ModelList}{Model, table and plot}
#' \item{name xtable}{xtable which can be used directly in Latex of alpha statistics}
#' @export
#'
fun_PlotsAndAlphaTable_v2 <- function(listExcess,
period = c("days", "weeks", "months"),
tablePeriods = c(1, 3, 6, 9, 12, 15, 18, 24),
savePlot = TRUE, outdir = "C:/Users/Soren Schwartz/Dropbox/Egne dokumenter/Skole/master/opgave/Figures/",
namesList = c("Cum", "BTC", "ETH", "XRP", "BCH")) {
xlist <- listExcess[[period]]
if(is.null(namesList)) {namesList <- names(xlist)}
outList <- list()
for(i in 1:length(xlist)) {
outList[[i*2-1]] <- fun_getLmStats_v2(xlist[[i]], tablePeriods = tablePeriods, sign = FALSE,
name = namesList[i], savePlot = savePlot,
period = period, outputFig = outdir)
outList[[i*2]] <- fun_getLmStats_v2(xlist[[i]], tablePeriods = tablePeriods, sign = TRUE,
name = namesList[i], savePlot = savePlot,
period = period, outputFig = outdir)
}
namesOutList <- character(length = length(namesList)*2)
for(i in 1:length(namesList)) {
namesOutList[i*2-1] <- namesList[i]
namesOutList[i*2] <- paste0(namesList, ".sign")[i]
}
names(outList) <- namesOutList
tdayStats <- do.call(cbind, lapply(outList, function(x) {
out <- x$table %>%
dplyr::filter(Parameter == "alpha") %>%
dplyr::select(`t value`)
rownames(out) <- x$table[seq(1,nrow(x$table),2),1]
return(out)
}))
colnames(tdayStats) <- names(outList)
outXtable <- xtable::xtable(t(tdayStats))
return(list(ModelList = outList,
xtable = outXtable))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.