- using R version 4.3.3 (2024-02-29 ucrt)
- using platform: x86_64-w64-mingw32 (64-bit)
- R was compiled by
gcc.exe (GCC) 12.3.0
GNU Fortran (GCC) 12.3.0
- running under: Windows Server 2022 x64 (build 20348)
- using session charset: UTF-8
- checking for file 'AssetAllocation/DESCRIPTION' ... OK
- checking extension type ... Package
- this is package 'AssetAllocation' version '1.1.1'
- package encoding: UTF-8
- checking package namespace information ... OK
- checking package dependencies ... OK
- checking if this is a source package ... OK
- checking if there is a namespace ... OK
- checking for hidden files and directories ... OK
- checking for portable file names ... OK
- checking whether package 'AssetAllocation' can be installed ... OK
See the install log for details.
- checking installed package size ... OK
- checking package directory ... OK
- checking 'build' directory ... OK
- checking DESCRIPTION meta-information ... OK
- checking top-level files ... OK
- checking for left-over files ... OK
- checking index information ... OK
- checking package subdirectories ... OK
- checking R files for non-ASCII characters ... OK
- checking R files for syntax errors ... OK
- checking whether the package can be loaded ... [1s] OK
- checking whether the package can be loaded with stated dependencies ... [1s] OK
- checking whether the package can be unloaded cleanly ... [1s] OK
- checking whether the namespace can be loaded with stated dependencies ... [1s] OK
- checking whether the namespace can be unloaded cleanly ... [1s] OK
- checking loading without being on the library search path ... [1s] OK
- checking use of S3 registration ... OK
- checking dependencies in R code ... OK
- checking S3 generic/method consistency ... OK
- checking replacement functions ... OK
- checking foreign function calls ... OK
- checking R code for possible problems ... [5s] OK
- checking Rd files ... [1s] OK
- checking Rd metadata ... OK
- checking Rd cross-references ... OK
- checking for missing documentation entries ... OK
- checking for code/documentation mismatches ... OK
- checking Rd \usage sections ... OK
- checking Rd contents ... OK
- checking for unstated dependencies in examples ... OK
- checking contents of 'data' directory ... OK
- checking data for non-ASCII characters ... [1s] OK
- checking LazyData ... OK
- checking data for ASCII and uncompressed saves ... OK
- checking installed files from 'inst/doc' ... OK
- checking files in 'vignettes' ... OK
- checking examples ... [5s] ERROR
Running examples in 'AssetAllocation-Ex.R' failed
The error most likely occurred in:
> ### Name: backtest_allocation
> ### Title: Backtesting of asset allocation strategies
> ### Aliases: backtest_allocation
>
> ### ** Examples
>
> # Example 1: backtesting one of the asset allocations in the package
> us_60_40 <- asset_allocations$static$us_60_40
> bt_us_60_40 <- backtest_allocation(us_60_40,
+ ETFs$Prices,
+ ETFs$Returns,
+ ETFs$risk_free)
>
> # show table with performance metrics
> bt_us_60_40$table_performance
United.States.60.40
Annualized Return 0.0729
Annualized Std Dev 0.1041
Annualized Sharpe (Rf=1.32%) 0.5642
daily downside risk 0.0047
Annualised downside risk 0.0739
Downside potential 0.0020
Omega 1.1240
Sortino ratio 0.0533
Upside potential 0.0022
Upside potential ratio 0.6257
Omega-sharpe ratio 0.1240
Semi Deviation 0.0048
Gain Deviation 0.0047
Loss Deviation 0.0054
Downside Deviation (MAR=210%) 0.0101
Downside Deviation (Rf=1.32%) 0.0047
Downside Deviation (0%) 0.0046
Maximum Drawdown 0.3260
Historical VaR (95%) -0.0098
Historical ES (95%) -0.0159
Modified VaR (95%) -0.0091
Modified ES (95%) -0.0111
> # Example 2: creating and backtesting an asset allocation from scratch
>
> # create a strategy that invests equally in momentum (MTUM), value (VLUE),
> # low volatility (USMV) and quality (QUAL) ETFs.
>
> factor_strat <- list(name = "EW Factors",
+ tickers = c("MTUM", "VLUE", "USMV", "QUAL"),
+ default_weights = c(0.25, 0.25, 0.25, 0.25),
+ rebalance_frequency = "month",
+ portfolio_rule_fn = "constant_weights")
>
> # get data for tickers using getSymbols
> factor_ETFs <- get_data_from_tickers(factor_strat$tickers,
+ starting_date = "2020-01-01")
> # backtest the strategy
> bt_factor_strat <- backtest_allocation(factor_strat,
+ factor_ETFs$P,
+ factor_ETFs$R)
Error in if (length(colnames(R)) == 1 && colnames(R) == colnames(Rf)) { :
missing value where TRUE/FALSE needed
Calls: backtest_allocation ... SharpeRatio.annualized -> sapply -> lapply -> FUN -> Return.excess
Execution halted
- checking for unstated dependencies in 'tests' ... OK
- checking tests ... [8s] OK
Running 'testthat.R' [8s]
- checking for unstated dependencies in vignettes ... OK
- checking package vignettes in 'inst/doc' ... OK
- checking re-building of vignette outputs ... [8s] ERROR
Error(s) in re-building vignettes:
--- re-building 'AssetAllocation.Rmd' using rmarkdown
Quitting from lines 154-164 [factors EW bt] (AssetAllocation.Rmd)
Error: processing vignette 'AssetAllocation.Rmd' failed with diagnostics:
missing value where TRUE/FALSE needed
--- failed re-building 'AssetAllocation.Rmd'
SUMMARY: processing the following file failed:
'AssetAllocation.Rmd'
Error: Vignette re-building failed.
Execution halted
- checking PDF version of manual ... [17s] OK
- checking HTML version of manual ... [3s] OK
- DONE
Status: 2 ERRORs