Description Usage Arguments Details Value Author(s) References See Also Examples
DSFM
performs a model estimation using Dynamic Semiparametric Factor
mechanics.
1 2 |
data |
a matrix containing time indicator in first row, value
Y_{t,j} in second row, and the coordinates X_{t,j} in the
remaining rows. Proper formatting has to be done using the
|
numDataPoints |
the number of points in the axis of the grid to perform the kernel density estimation. |
h |
the bandwidth used to perform the kernel density estimation. In one dimension, can be either a single global parameter, or a vector of the same length of numDataPoints to perform local kernel estimation. In two dimension, can be a single global parameter, a vector of two bandwidths (one by dimension) or a matrix of size numDataPoints x 2 for local bandwidth. |
L |
the number of underlying factors. |
initialLoad |
the type of initial loadings to choose between White Noise
|
tol |
the tolerance for the algorithm to stop. |
maxIt |
the maximum number of iterations for the algorithm to break. |
Dynamic Semiparametric Factor Models (DSFM) are defined as Y_{t,j} = m_0(X_{t,j}) + ∑_{l=1}^L Z_{t,l} m_l(X_{t,j}) + \varepsilon_{t,j}. DSFM estimation is performed using kernel density for the non-parametric functions m_l. The estimation is performed using the iterative algorithm of Fengler and al. (2007).
The function has predefined arguments that can be changed for better approximation. First, the number of data points on the estimation grid is set to 25. Larger grid can significantly increase the computation time without necesseraly improve the fit. Secondly, the bandwidth h is basically set to 0.05 but optimal bandwidth has to be found externally. The algorithm always normalize the covariates to work on an estimation grid bounded beetween [0,1].
For model selection, different criteria are computed.
For number of factors selection, the function compute the Explained Variance, for bandwidth selection, two criteria are computed, a weighted Akaike Information Criterion (AIC) and a weighted Schwarz Criterion (SC). The goodness-of-fit is measured by the Root Mean Squared Error (RMSE). The proper definition of each criterion can be found in references.
DSFM
returns an object of class "DSFM1D"
or
"DSFM2D"
depending on the dimension of the input data.
The generic functions print
, summary
, plot
and
predict
are available.
An object of class "DSFM1D"
is a list containing the following
components:
|
the input data. |
|
the input data in a more usual format, i.e. a matrix with a time indicator as first row and the following rows being the value Y_{t,j} for each covariates X_{t,j}. |
|
the estimated \hat{Y}_{t,j} with the same format, i.e. a matrix with a time indicator as first row and the following rows being the value \hat{Y}_{t,j} for each covariates X_{t,j}. |
|
the estimated factor loadings \hat{Z}_{t,j}. |
|
the estimated factor functions \hat{m}_l. |
|
the error terms. |
|
gives the Explained Variance, used to select the approriate number of factors. |
|
gives the Root Mean Squared Error, used to compare the goodness-of-fit between models. |
|
gives the bandwidth h used and two selection criteria to select the optimal bandwidth. |
|
the vector of bandwidths used at each kernel point. |
|
the vector of the covariates. |
|
the kernel density estimation performed. |
|
the value of the algorithm stopping criterion at each loop. |
|
an indicator of the time taken by the function to perform the fit. |
Object of class "DSFM2D"
provides more or less the same outputs
except that the Y
, YHat
and residuals
are kept in the
specific "DSFM2DData"
format.
The implementation of model by Marc Gumowski was based on Fengler and al. (2007).
Borak, Szymon, Matthias R. Fengler, and Wolfgang K. Haerdle (2005). "DSFM Fitting of Implied Volatility Surfaces". In: 5th International Conference on Intelligent Systems Design and Applications (ISDA'05), pp. 526-531. IEEE.
Fengler, Matthias R, Wolfgang K Haerdle, and Enno Mammen (2007). "A Semiparametric Factor Model for Implied Volatility Surface Dynamics". In: Journal of Financial Econometrics 5.2, pp. 189-218.
Haerdle, Wolfgang K., and Piotr Majer (2014). "Yield Curve Modeling and Forecasting using Semiparametric Factor Dynamics". In: The European Journal of Finance, pp. 1-21.
summary.DSFM1D
/ summary.DSFM2D
for
summaries and plot.DSFM1D
/ plot.DSFM2D
for plot
possibilities.
predict.DSFM1D
/ predict.DSFM2D
provide succint
predictions.
DSFM1DData
/ DSFM2DData
have to be used before
using the DSFM
function to ensure that the data are correctly
formated.
simulateDSFM1D
/ simulateDSFM2D
are functions
to simulate data that can be used as simple example purposes.
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 | ## One-Dimensional Data #################################################### #
# Prepare the data --------------------------------------------------------- #
# Interest rate of zero-coupon bond yield curves. Data from Bank of Canada.
data(canadianYieldCurves)
maturity <- c(1/4, 1/2, 3/4, 1:10, 20, 30)
dsfmData <- DSFM1DData(canadianYieldCurves[1:400, ], maturity)
dsfmData
plot(dsfmData)
# Set the parameters ------------------------------------------------------- #
h <- 0.167
L <- 3
# Fit the model ------------------------------------------------------------ #
dsfmFit <- DSFM(dsfmData, h = h, L = L)
summary(dsfmFit)
plot(dsfmFit)
# Perform prediction ------------------------------------------------------- #
horizon <- 5
predict(dsfmFit, nAhead = horizon)
## Two-Dimensional Data #################################################### #
# Prepare the data --------------------------------------------------------- #
simulatedData <- simulateDSFM2D()
dsfmData <- simulatedData$dataSim
# Set the parameters ------------------------------------------------------- #
h <- c(0.05, 0.05)
L <- 4
# Fit the model ------------------------------------------------------------ #
dsfmFit <- DSFM(dsfmData, h = h, L = L)
summary(dsfmFit)
plot(dsfmFit)
# Perform prediction ------------------------------------------------------- #
horizon <- 5
predict(dsfmFit, nAhead = horizon)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.