Learn R Programming

fAssets (version 3003.81-1)

assets-modeling: Modeling of Multivariate Asset Sets

Description

Fits the parameters to a multivariate normal, skew normal, or (skew) Student-t distribution and allows to simulate artificial asset series.

Usage

assetsFit(x, method = c("st", "snorm", "norm"), title = NULL, 
    description = NULL, fixed.df = NA)
    
assetsSim(n, dim = 2, model = list(mu = rep(0, dim), Omega = diag(dim), 
    alpha = rep(0, dim), df = Inf), assetNames = NULL)

Arguments

x
a numeric matrix of returns or any other rectangular object like a data.frame or a multivariate time series object which can be transformed by the function as.matrix to an object of class matrix.
n
integer value, the number of data records to be simulated.
method
a character string, which type of distribution should be fitted? method="st" denotes a multivariate skew-Student-t distribution, method="snorm" a multivariate skew-Normal distribution, and method="no
dim
integer value, the dimension (number of columns) of the assets set.
model
a list of model parameters: mu a vector of mean values, one for each asset series, Omega the covariance matrix of assets, alpha the skewness vector, and df the number of degrees of freedom which is a
assetNames
[assetsSim] - a vector of character strings of length dim allowing for modifying the names of the individual assets.
title
a character string, assigning a title to an "fASSETS" object.
description
a character string, assigning a brief description to an "fASSETS" object.
fixed.df
either NA, the default, or a numeric value assigning the number of degrees of freedom to the model. In the case that fixed.df=NA the value of df will be included in the optimization process,
...
optional arguments to be passed.

Value

  • assetsFit() returns a list with two entries, the parameters param and fit. param is again alist with the fitted distributional parameters, param=list(mu, Omega, alpha, df. fit is a list which contains the returned values from the sn fitting function. For details we refer to the manual of the sn package. Note that the param$model entry can be used as input to the function assetsSim for simulating a similar portfolio of assets compared with the original portfolio data. assetsSim() returns a signal series (S4 time Series object) of simulated assets.

Details

The function assetsFit for the parameter estimation uses code based on functions from the contributed packages "mtvnorm" and "sn" for fitting data to a multivariate Normal, skew-Normal, and/or skew-Student-t distribution.

References

Azzalini A. (1985); A Class of Distributions Which Includes the Normal Ones, Scandinavian Journal of Statistics 12, 171--178.

Azzalini A. (1986); Further Results on a Class of Distributions Which Includes the Normal Ones, Statistica 46, 199--208.

Azzalini A., Dalla Valle A. (1996); The Multivariate Skew-normal Distribution, Biometrika 83, 715--726.

Azzalini A., Capitanio A. (1999); Statistical Applications of the Multivariate Skew-normal Distribution, Journal Roy. Statist. Soc. B61, 579--602.

Azzalini A., Capitanio A. (2003); Distributions Generated by Perturbation of Symmetry with Emphasis on a Multivariate Skew-t Distribution, Journal Roy. Statist. Soc. B65, 367--389. Genz A., Bretz F. (1999); Numerical Computation of Multivariate t-Probabilities with Application to Power Calculation of Multiple Contrasts, Journal of Statistical Computation and Simulation 63, 361--378.

Genz A. (1992); Numerical Computation of Multivariate Normal Probabilities, Journal of Computational and Graphical Statistics 1, 141--149. Genz A. (1993); Comparison of Methods for the Computation of Multivariate Normal Probabilities, Computing Science and Statistics 25, 400--405. Hothorn T., Bretz F., Genz A. (2001); On Multivariate t and Gauss Probabilities in R, R News 1/2, 27--29. Wuertz, D., Chalabi, Y., Chen W., Ellis A. (2009); Portfolio Optimization with R/Rmetrics, Rmetrics eBook, Rmetrics Association and Finance Online, Zurich.

Examples

Run this code
## LPP2005REC -
   # Load Swiss Pension Fund Data as Percentual Returns:
   LPP <- 100 * LPP2005REC[, 1:3]
   head(LPP)
   
## assetsFit -
   # Fit a Skew-Student-t Distribution: 
   fit <- assetsFit(LPP)
   # Show Model Slot:
   print(fit$param)
   
## assetsSim -
   # Simulate set with same statistical properties:
   set.seed(1953)
   LPP.SIM <- assetsSim(n=nrow(LPP), dim=ncol(LPP), model=fit$param)
   colnames(LPP.SIM) <- colnames(LPP)
   head(LPP.SIM)

Run the code above in your browser using DataLab