factorModelMonteCarlo: Simulate returns using factor model Monte Carlo method.

Description Usage Arguments Details Value Author(s) References Examples

Description

Simulate returns using factor model Monte Carlo method. Parametric method like normal distribution, Cornish-Fisher and skew-t distribution for residuals can be selected. Resampling method such as non-parametric bootstrap or stationary bootstrap can be selected.

Usage

1
2
3
4
5
  factorModelMonteCarlo(n.boot = 1000, factorData,
    Beta.mat, Alpha.mat = NULL, residualData,
    residual.dist = c("normal", "Cornish-Fisher", "skew-t"),
    boot.method = c("random", "block"), seed = 123,
    return.factors = FALSE, return.residuals = FALSE)

Arguments

n.boot

Integer number of bootstrap samples.

factorData

n.months x n.funds matrix or data.frame of factor returns.

Beta.mat

n.funds x n.factors matrix of factor betas.

Alpha.mat

n.funds x 1 matrix of factor alphas (intercepts). If NULL then assume that all alphas are zero.

residualData

n.funds x n.parms matrix of residual distribution parameters. The columns of residualData depend on the value of residual.dist. If residual.dist = "normal", then residualData has one column containing variance values; if residual.dist = "Cornish-Fisher", then residualData has three columns containing variance, skewness and excess kurtosis values; if residual.dist="skew-t", then residualData has four columns containing location, scale, shape, and df values.

residual.dist

character vector specifying the residual distribution. Choices are "normal" for the normal distribution; "Cornish-Fisher" for the Cornish-Fisher distribution based on the Cornish-Fisher expansion of the normal distribution quantile; "skew-t" for the skewed Student's t distribution of Azzalini and Captiano.

boot.method

character vector specifying the resampling method. Choices are "random" for random sampling with replacement (non-parametric bootstrap); "block" for stationary block bootstrapping.

seed

integer random number seed used for resampling the factor returns.

return.factors

logical; if TRUE then return resampled factors in output list object.

return.residuals

logical; if TRUE then return simulated residuals in output list object.

Details

The factor model Monte Carlo method is described in Jiang (2009).

Value

A list with the following components:

Author(s)

Eric Zivot and Yi-An Chen.

References

Jiang, Y. (2009). UW PhD Thesis.

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
34
# load data from the database
data(managers.df)
fit <- fitTimeSeriesFactorModel(assets.names=colnames(managers.df[,(1:6)]),
                                factors.names=c("EDHEC.LS.EQ","SP500.TR"),
                                data=managers.df,fit.method="OLS")
factorData= managers.df[,c("EDHEC.LS.EQ","SP500.TR")]
Beta.mat=fit$beta
residualData=as.matrix(fit$resid.variance,1,6)
n.boot=1000
# bootstrap returns data from factor model with residuals sample from normal distribution
bootData <- factorModelMonteCarlo(n.boot, factorData,Beta.mat, residual.dist="normal",
                                  residualData, Alpha.mat=NULL, boot.method="random",
                                  seed = 123, return.factors = "TRUE", return.residuals =
                                  "TRUE")
# Cornish-Fisher distribution
# build different residualData matrix
residualData <- cbind(c(1,2,1,3,0.1,0.5),rnorm(6),c(2,3,1,2,1,0))
colnames(residualData) <- c("var","skew","ekurt")
rownames(residualData) <- colnames(managers.df[,(1:6)])
bootData <- factorModelMonteCarlo(n.boot, factorData,Beta.mat, residual.dist="Cornish-Fisher",
                                  residualData, Alpha.mat=NULL, boot.method="random",
                                  seed = 123, return.factors = "TRUE", return.residuals =
                                  "TRUE")


# skew-t distribution
# build residualData matrix
residualData <- cbind(rnorm(6),c(1,2,1,3,0.1,0.5),rnorm(6),c(2,3,1,6,10,100))
colnames(residualData) <- c("location","scale","shape","df")
rownames(residualData) <- colnames(managers.df[,(1:6)])
bootData <- factorModelMonteCarlo(n.boot, factorData,Beta.mat, residual.dist="skew-t",
                                  residualData, Alpha.mat=NULL, boot.method="random",
                                  seed = 123, return.factors = "TRUE", return.residuals =
                                  "TRUE")

R-Finance/FactorAnalytics documentation built on May 8, 2019, 3:51 a.m.