fitmnts | R Documentation |
fitmnts
fit parameters
of the n-dimensional NTS distribution.
r = \mu + diag(\sigma) X
where
X
follows stdNTS_n(\alpha, \theta, \beta, \Sigma)
res <- fitmnts(returndata, n)
res <- fitmnts(returndata, n, alphaNtheta = c(alpha, theta))
res <- fitmnts(returndata, n, stdflag = TRUE )
res <- fitmnts(returndata, n, alphaNtheta = c(alpha, theta), stdflag = TRUE)
returndata |
Raw data to fit the parameters. The data must be given as a matrix form. Each column of the matrix contains a sequence of asset returns. The number of row of the matrix is the number of assets. |
n |
Dimension of the data. That is the number of assets. |
alphaNtheta |
If |
stdflag |
If you want only standard NTS parameter fit, set this value be TRUE. |
Structure of parameters for the n-dimensional NTS distribution.
res$mu
: \mu
mean vector of the input data.
res$sigma
: \sigma
standard deviation vector of the input data.
res$alpha
: \alpha
of the std NTS distribution (X).
res$theta
: \theta
of the std NTS distribution (X).
res$beta
: \beta
vector of the std NTS distribution (X).
res$Rho
: \rho
matrix of the std NTS distribution (X),
which is correlation matrix of epsilon.
res$CovMtx
: Covariance matrix of return data r
.
Kim, Y. S. (2020) Portfolio Optimization on the Dispersion Risk and the Asymmetric Tail Risk https://arxiv.org/pdf/2007.13972.pdf
library(functional)
library(nloptr)
library(pracma)
library(spatstat)
library(evmix)
library(Matrix)
library(quantmod)
library(temStaR)
getSymbols("^GSPC", src="yahoo", from = "2016-1-1", to = "2020-08-31")
pr1 <- as.numeric(GSPC$GSPC.Adjusted)
getSymbols("^DJI", src="yahoo", from = "2016-1-1", to = "2020-08-31")
pr2 <- as.numeric(DJI$DJI.Adjusted)
returndata <- matrix(data = c(diff(log(pr1)),diff(log(pr2))),
ncol = 2, nrow = (length(pr1)-1))
res <- fitmnts( returndata = returndata, n=2 )
#Fix alpha and theta.
#Estimate alpha dna theta from DJIA and use those parameter for IBM, INTC parameter fit.
getSymbols("^DJI", src="yahoo", from = "2016-1-1", to = "2020-08-31")
prDJ <- as.numeric(DJI$DJI.Adjusted)
ret <- diff(log(prDJ))
ntsparam <- fitnts(ret)
getSymbols("IBM", src="yahoo", from = "2016-1-1", to = "2020-08-31")
pr1 <- as.numeric(IBM$IBM.Adjusted)
getSymbols("INTC", src="yahoo", from = "2016-1-1", to = "2020-08-31")
pr2 <- as.numeric(INTC$INTC.Adjusted)
returndata <- matrix(data = c(diff(log(pr1)),diff(log(pr2))),
ncol = 2, nrow = (length(pr1)-1))
res <- fitmnts( returndata = returndata,
n = 2,
alphaNtheta = c(ntsparam["alpha"], ntsparam["theta"]) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.