Description Usage Arguments Details Value Author(s) Examples
Function which computes the semideviation
1 | semidevEstimation(rets, control = list())
|
rets |
a (T x N) matrix of past returns. |
control |
control parameters (see *Details*). |
The argument control
is a list that can supply any of the following components:
type
method used to compute the semideviation vector, among 'naive'
and 'ewma'
where:
'naive'
is used to compute the simple semideviation.
'ewma'
is used to compute the exponential weighted moving average semideviation. The data
must be sorted from the oldest to the latest.
The semideviation for one stock is computed as follows. First we select the returns which are smaller than the average of the past returns; we get a new vector of dimension K \times 1, K ≤ N. Then, the weight w_i for each observation at its corresponding time t is computed as w = λ^{t}. We obtain a Kx1 vector. The vector of weights is then normalized. Finally, the semideviation is obtained as the weighted standard deviation.
Default: type = 'naive'
.
lambda
decay parameter. Default: lambda = 0.94
.
A (N x 1) vector of semideviations.
David Ardia <david.ardia@unifr.ch> and Jean-Philippe Gagnon Fleury.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | set.seed(3214)
T = 100
N = 25
rets = matrix(rnorm(T*N), nrow = T, ncol = N)
#Computes the naive semideviation estimation.
semidevEstimation(rets)
#Computes the naive estimation of the semideviation.
semidevEstimation(rets, control = list(type = "naive"))
#Computes the ewma estimation of the semideviation. Default lambda = 0.94.
semidevEstimation(rets, control = list(type = "ewma"))
#Computes the ewma estimation of the semideviation. Lambda = 0.9.
semidevEstimation(rets, control = list(type = "ewma", lambda = 0.9))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.