| fitTsfmUpDn | R Documentation |
This is a wrapper function to fits a up and down market model
for one or more asset returns or excess returns using time series regression.
Users can choose between ordinary least squares-LS, discounted least
squares-DLS (or) robust regression. An object of class
"tsfmUpDn" is returned.
fitTsfmUpDn(
asset.names,
mkt.name,
rf.name = NULL,
data = data,
fit.method = c("LS", "DLS", "Robust"),
control = fitTsfm.control(...),
...
)
asset.names |
Vector containing syntactically valid names of assets, whose returns or excess returns are the dependent variable. |
mkt.name |
Syntactically valid name for market returns. Required for an up/down market model. |
rf.name |
Syntactically valid name of the risk free rate to calculate
excess returns for all assets (in |
data |
vector, matrix, data.frame, xts, timeSeries or zoo object
containing column(s) named in |
fit.method |
the estimation method, one of "LS", "DLS" or "Robust". See details. Default is "LS". |
control |
list of control parameters. The default is constructed by
the function |
... |
arguments passed to |
fitTsfmUpDn will use fitTsfm to fit a time series model for up
and down market respectively. If risk free rate is provided, the up market is
the excess market returns which is no less than 0.
The goal of up and down market model is to capture two different market Betas
in the up and down markets.
fitTsfmUpDn returns an object tsfmUpDn. It supports generic
function such as summary, predict, plot and print.
It is also a list object containing Up and Dn. Both Up
and Dn are class of "tsfm". As a result, for each list
object, The generic function such as print, plot, predict
and summary methods exist for both Up and Dn. Also, the
generic accessor functions coef, fitted, residuals and
fmCov can be applied as well.
An object of class "tsfmUpDn" is a list containing Up and Dn:
Up |
An object of |
Dn |
An object of |
and others useful items:
call |
Function call. |
data |
Original data used but converted to |
Each object of tsfm contains :
asset.fit |
list of fitted objects for each asset. Each object is of
class |
alpha |
length-N vector of estimated alphas. |
beta |
N x 1 matrix of estimated betas. |
r2 |
length-N vector of R-squared values. |
resid.sd |
length-N vector of residual standard deviations. |
call |
the matched function call. |
data |
xts data object containing the assets and factors. |
asset.names |
asset.names as input. |
factor.names |
factor.names as input. |
fit.method |
fit.method as input. |
Where N is the number of assets and T is the number of time periods.
Yi-An Chen.
Christopherson, J. A., Carino, D. R., & Ferson, W. E. (2009). Portfolio performance measurement and benchmarking. McGraw Hill Professional.
The tsfmUpDn methods for generic functions:
plot.tsfmUpDn, predict.tsfmUpDn,
print.tsfmUpDn and summary.tsfmUpDn.
The original time series function fitTsfm and its generic
functions application.
# load data
data(managers, package = 'PerformanceAnalytics')
# example: Up and down market factor model with LS fit
fitUpDn <- fitTsfmUpDn(asset.names = colnames(managers[,(1:6)]),
mkt.name = "SP500 TR",
data = managers,
fit.method = "LS")
print(fitUpDn)
summary(fitUpDn)
# A list object
fitUpDn
summary(fitUpDn$Up)
summary(fitUpDn$Dn)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.