fitmnts: fitmnts

Description Usage Arguments Value References Examples

View source: R/distMultiNTS.R

Description

fitmnts fit parameters of the n-dimensional NTS distribution.

r = μ + diag(σ) X

where

X follows stdNTS_n(α, θ, β, Σ)

Usage

1
2
3
4
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)

Arguments

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 α and θ are given, then put those numbers in this parameter. The function fixes those parameters and fits other remaining parameters. If you set alphaNtheta = NULL, then the function fits all parameters including α and θ.

stdflag

If you want only standard NTS parameter fit, set this value be TRUE.

Value

Structure of parameters for the n-dimensional NTS distribution.

res$mu : μ mean vector of the input data.

res$sigma : σ standard deviation vector of the input data.

res$alpha : α of the std NTS distribution (X).

res$theta : θ of the std NTS distribution (X).

res$beta : β vector of the std NTS distribution (X).

res$Rho : ρ matrix of the std NTS distribution (X), which is correlation matrix of epsilon.

res$CovMtx : Covariance matrix of return data r.

References

Kim, Y. S. (2020) Portfolio Optimization on the Dispersion Risk and the Asymmetric Tail Risk https://arxiv.org/pdf/2007.13972.pdf

Examples

 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
library(functional)
library(nloptr)
library(pracma)
library(spatstat)
library(Matrix)
library(quantmod)

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 = "2020-8-25", 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"])  )

aaron9011/temStaR-v0.814 documentation built on Dec. 24, 2021, 6:16 p.m.