Hi all. I'm a R newbie, so please bear with me.
I'm fitting nine log losses series (log returns multiplied by -1, so that I
have losses on the right and returns on the left) using copulas. My project in
more detail:
1) I've filtered the residuals using univariate ARMA-GARCH models, and
standardized them dividing by sigma, so that now I have standardized residuals
with mean 0 and variance 1 (rugarch package).
2) I modeled the residuals using the generalized pareto distribution family, for
all nine series I'm using upper and lower thresholds equal to 0.95 and 0.05
quantiles respectively (spd package).
3) After turning the standardized residuals to their uniform margins using pspd,
I'm fitting a Gumbel copula which has upper tail dependence since I'm
focusing on losses which are on the right (copula package).
Next part of the work: i) I want to estimate a time-varying Gumbel parameter;
ii) given predicted parameter, simulate copula realizations; iii) using the
inverse marginal distributions, turn these realizations into standardized
residuals; iv) compute returns using ARMA-GARCH specification, convert into
simple returns, compute return of equally weighted portfolio and
estimate/backtest value at risk and expected shortfall.
Being done with first 2 steps, now I want to estimate a time varying Gumbel. So
I'm trying to extract the parameter with a moving window of 500 observations
to get an idea of how the time series looks like.
My code looks like this:
theta <- c()
for (i in 1:3345)
{
theta[i]=summary(fitCopula(gumbel.cop,standardized[i:(i+499),],
method="ml"))$coefficients[1]
}
where standardized is a matrix with 9 columns, each with the uniform margin
between 0 and 1. So I want to estimate 3345 theta using a window of 500
observations, from theta_1 (obs. 1 to 500) to theta_3345 (obs. 3345 to 4344).
However, while running this code, I get:
Error in optim(start, loglikCopula, lower = lower, upper = upper, method =
method, :
valore iniziale in 'vmmin' non finito
where the last sentence can be translated with "initial value in
"vmmin" not finite".
What is this error due to? How can I fix this in the command? It runs for the
first 1339 estimates (which I've obtained), but from i=1340 this message
shows up and I have NA as estimated value.
Any help is appreciated. Thanks.
[[alternative HTML version deleted]]