[R-SIG-Finance] (no subject)
Gareth McEwan
mcewan.gareth at gmail.com
Wed Oct 22 15:46:31 CEST 2014
Hi all
I need to transform standardized GARCH residuals to uniform variates by a
marginal semi-parametric empirical CDF.
For a set of 242 standardized residuals (sorted.ALBI.std.resids), I have
cut off 10% at the upper tail and 10% at the lower tail (by theory and
testing, these thresholds are valid).
I have a set of 24 (positive) values for the lower tail (by multiplying by
-1), a set of 24 values for the upper tail, and 194 values for the interior
(kernel) of the distribution.
These values correspond to a choice of threshold at
quantile(neg.sorted.ALBI.resids,0.90) for the lower tail #equals 1.213646
and
quantile(sorted.ALBI.std.resids,0.90) for the upper tail #equals 1.218522.
I used the "evir", "ismev", and "fExtremes" packages to fit and
double-check estimates and they are all extremely close.
Output:
For lower tail:
gpdfit.mle.ALBI =
gpdFit(neg.tail.ALBI.resids,u=quantile(neg.sorted.ALBI.resids,0.90),type="mle")
summary(gpdfit.mle.ALBI)
# xi (shape) beta (scale) LLH Value
# 0.1051834 0.7098641 18.30353
#SE: 0.2443332 SE: 0.2254843
For upper tail:
gpdfit.mle.ALBI =
gpdFit(pos.tail.ALBI.resids,u=quantile(sorted.ALBI.std.resids,0.90),type="mle")
summary(gpdfit.mle.ALBI) # Maximum likelihood parameter estimation method
# xi (shape) beta (scale) LLH Value
# -0.1996078 0.4973661 2.447625
#SE: 0.2571947 SE: 0.1620495
For interior:
fit.interior.ALBI.std.resids =
density(kernel.ALBI.std.resids,bw="nrd0",adjust=1,kernel="gaussian")
The question I'd like to ask is: how do I now combine the non-parametric
interior with the estimated tails to get a CDF function? It is this
semi-parametric CDF function that I need to use to transform the
standardized residuals to uniform variates.
Thank you very much for the help (files are attached for reproducibility).
Best regards
Gareth
P.S. I would prefer to use the above framework, if possible. However, I
did use the following, but got conflicting output for the threshold and
tail estimates:
spd.fit.ALBI=spdfit(sorted.ALBI.std.resids, upper=0.9, lower=0.1,
tailfit="GPD", type="mle", kernelfit="normal", information="observed")
show(spd.fit.ALBI)
# Upper Tail: Threshold = 1.22226 (compared to 1.218522 using quantile
function)
# Estimated Parameters
# xi beta
# -0.18608 0.48698
# Lower Tail: Threshold = -1.22126 (compared to -1.213646 using quantile
function on sorted.ALBI.std.resids)
# Estimated Parameters
# xi beta
# 0.06574 0.76526
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20141022/2c024de5/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kernel_ALBI_std_resids.csv
Type: text/csv
Size: 4836 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20141022/2c024de5/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sorted_ALBI_std_resids.csv
Type: text/csv
Size: 6010 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20141022/2c024de5/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: neg_tail_ALBI_std_resids.csv
Type: text/csv
Size: 549 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20141022/2c024de5/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pos_tail_ALBI_std_resids.csv
Type: text/csv
Size: 549 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20141022/2c024de5/attachment-0003.bin>
More information about the R-SIG-Finance
mailing list