-
Notifications
You must be signed in to change notification settings - Fork 7
/
README.Rmd
111 lines (79 loc) · 3.84 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
---
always_allow_html: yes
output:
html_document:
keep_md: yes
variant: markdown_github
md_document:
variant: markdown_github
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
library(knitr)
opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
fig.align = "center",
fig.retina = 2,
out.width = "75%",
dpi = 96
)
knit_hooks$set(pngquant = hook_pngquant)
```
# highOrderPortfolios
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/highOrderPortfolios)](https://CRAN.R-project.org/package=highOrderPortfolios)
[![CRAN Downloads](https://cranlogs.r-pkg.org/badges/highOrderPortfolios)](https://CRAN.R-project.org/package=highOrderPortfolios)
[![CRAN Downloads Total](https://cranlogs.r-pkg.org/badges/grand-total/highOrderPortfolios?color=brightgreen)](https://CRAN.R-project.org/package=highOrderPortfolios)
The classical Markowitz's mean-variance portfolio formulation ignores
heavy tails and skewness. High-order portfolios use higher order moments to
better characterize the return distribution. Different formulations and fast
algorithms are proposed for high-order portfolios based on the mean, variance,
skewness, and kurtosis.
The package is based on the papers [Zhou and Palomar (2021)](https://arxiv.org/abs/2008.00863)
and [Wang, Zhou, Ying, and Palomar (2022)](https://arxiv.org/pdf/2206.02412v1.pdf).
## Installation
The package can be installed from [CRAN](https://CRAN.R-project.org/package=highOrderPortfolios) or [GitHub](https://github.com/dppalomar/highOrderPortfolios):
```{r, eval=FALSE}
# install stable version from CRAN
install.packages("highOrderPortfolios")
# install development version from GitHub
devtools::install_github("dppalomar/highOrderPortfolios")
```
To get help:
```{r, eval=FALSE}
library(highOrderPortfolios)
help(package = "highOrderPortfolios")
?design_MVSK_portfolio_via_sample_moments
?design_MVSK_portfolio_via_skew_t
```
To cite `highOrderPortfolios` in publications:
```{r, eval=FALSE}
citation("highOrderPortfolios")
```
## Usage
```{r, fig.width=9, fig.height=4, out.width="70%"}
library(highOrderPortfolios)
data(X50)
# non-parametric case: estimate sample moments
X_moments <- estimate_sample_moments(X50)
# parametric case: estimate the multivariate skew t distribution
X_skew_t_params <- estimate_skew_t(X50)
# choose hyper-parameter moment weights for the MVSK formulation
xi <- 10
lmd <- c(1, xi/2, xi*(xi+1)/6, xi*(xi+1)*(xi+2)/24)
# design portfolio
sol_nonparam <- design_MVSK_portfolio_via_sample_moments(lmd, X_moments)
sol_param <- design_MVSK_portfolio_via_skew_t(lmd, X_skew_t_params)
# plot
barplot(cbind("via sample moments" = sol_nonparam$w, "via skew t modeling" = sol_param$w), beside = TRUE,
col = c(rep("darkblue", 50), rep("darkred", 50)),
main = "MSVK portfolio", xlab = "asset indexes", ylab = "portfolio weights")
```
## Documentation
For more detailed information, please check the vignette:
[CRAN-vignette](https://CRAN.R-project.org/package=highOrderPortfolios/vignettes/DesignOfHighOrderPortfolios.html) and [GitHub-vignette](https://htmlpreview.github.io/?https://github.com/dppalomar/highOrderPortfolios/blob/master/vignettes/DesignOfHighOrderPortfolios.html).
## Links
Package: [CRAN](https://CRAN.R-project.org/package=highOrderPortfolios) and [GitHub](https://github.com/dppalomar/highOrderPortfolios).
README file: [CRAN-readme](https://CRAN.R-project.org/package=highOrderPortfolios/readme/README.html) and [GitHub-readme](https://github.com/dppalomar/highOrderPortfolios/blob/master/README.md).
Vignette: [CRAN-vignette](https://CRAN.R-project.org/package=highOrderPortfolios/vignettes/DesignOfHighOrderPortfolios.html) and [GitHub-vignette](https://htmlpreview.github.io/?https://github.com/dppalomar/highOrderPortfolios/blob/master/vignettes/DesignOfHighOrderPortfolios.html).