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
"","x"
"1",-1.21869156644165
"2",-1.16823822070044
"3",-1.14413410502718
"4",-1.14017116935513
"5",-1.13610689026042
"6",-1.04802315153697
"7",-1.02537382207794
"8",-0.976306575019353
"9",-0.972846565263427
"10",-0.931546138516482
"11",-0.92620360782696
"12",-0.91430785083673
"13",-0.9076059009389
"14",-0.904698858722735
"15",-0.899765459236646
"16",-0.896801278427396
"17",-0.842688842939503
"18",-0.799764915990784
"19",-0.790181807730654
"20",-0.779737875400704
"21",-0.748170819200895
"22",-0.747620964585755
"23",-0.723814001907761
"24",-0.703672974288052
"25",-0.694024296405918
"26",-0.684415927208363
"27",-0.653541620323278
"28",-0.641448178713844
"29",-0.63793961883217
"30",-0.6079988154208
"31",-0.591315169432083
"32",-0.588629908016093
"33",-0.583620846520253
"34",-0.583258354242871
"35",-0.577813482630085
"36",-0.567986061711903
"37",-0.558317776134144
"38",-0.556301995730657
"39",-0.555453167286526
"40",-0.553392357530657
"41",-0.550494800180106
"42",-0.546383128116369
"43",-0.537294918840742
"44",-0.536335026159591
"45",-0.522819114629976
"46",-0.518936902074394
"47",-0.512639113532678
"48",-0.49888843398999
"49",-0.48647741521696
"50",-0.484990569937416
"51",-0.475052220867575
"52",-0.471009614586147
"53",-0.447842094966283
"54",-0.436258733398278
"55",-0.431131286093315
"56",-0.424628131174874
"57",-0.418612978839984
"58",-0.412817097201873
"59",-0.400061819012557
"60",-0.395802282212732
"61",-0.369845170294317
"62",-0.322246276815395
"63",-0.310892416823284
"64",-0.306880696158364
"65",-0.302007392098573
"66",-0.296638423335579
"67",-0.280292137140459
"68",-0.276604822616098
"69",-0.260960584889959
"70",-0.245874968219429
"71",-0.244045715547781
"72",-0.242986120114656
"73",-0.237770488737
"74",-0.217954612049585
"75",-0.211119462441727
"76",-0.192467703255311
"77",-0.185050068943234
"78",-0.155434377987752
"79",-0.142675340685898
"80",-0.131478995778401
"81",-0.120968994554261
"82",-0.112175632157977
"83",-0.111865603631534
"84",-0.110611840177199
"85",-0.0987745018280409
"86",-0.0957956330211523
"87",-0.0813523480106355
"88",-0.0809683732279013
"89",-0.0715256913526965
"90",-0.0705427149337193
"91",-0.0566829697641671
"92",-0.0552884389356196
"93",-0.0490581038758615
"94",-0.0331038749290681
"95",-0.0193785907514093
"96",-0.00104669938711808
"97",0.00593942552902084
"98",0.0162704918493848
"99",0.0290742721481726
"100",0.0297798221926759
"101",0.0391169032653739
"102",0.0489324115119895
"103",0.0662036014753268
"104",0.0814329533855254
"105",0.0869105344688676
"106",0.0887654630633744
"107",0.0914462986434958
"108",0.091846660320617
"109",0.108311037655672
"110",0.115100959183187
"111",0.119704456326755
"112",0.120097049422945
"113",0.123666265115735
"114",0.152223247819972
"115",0.162419603540448
"116",0.167100925574481
"117",0.169815123719659
"118",0.173090388232057
"119",0.187619004023763
"120",0.192431216292059
"121",0.199650482162789
"122",0.205375493923737
"123",0.206071563682823
"124",0.213217500436123
"125",0.213496890001305
"126",0.215498817444672
"127",0.227776260145795
"128",0.251216234373393
"129",0.257735597424298
"130",0.260218523092302
"131",0.270864487088763
"132",0.300220610567537
"133",0.305988921709446
"134",0.315071653981933
"135",0.331351514686139
"136",0.334739501199953
"137",0.34534565739046
"138",0.349233372854937
"139",0.352312574931049
"140",0.378333365508297
"141",0.379891189515099
"142",0.380841877796028
"143",0.388648918213087
"144",0.398146123561649
"145",0.411986803174549
"146",0.43437277945454
"147",0.43796043411846
"148",0.457850423577356
"149",0.469859238966312
"150",0.475246446654105
"151",0.488014540205857
"152",0.502153493707546
"153",0.508244394649783
"154",0.520269662180303
"155",0.53370166471072
"156",0.535766212062697
"157",0.560597618746085
"158",0.565696609537835
"159",0.567848747807281
"160",0.585189539932457
"161",0.58579562570861
"162",0.601663201018232
"163",0.603530562359243
"164",0.612561569793923
"165",0.615046010770534
"166",0.632395432330972
"167",0.637566153094828
"168",0.641594977461323
"169",0.646032100476025
"170",0.649426100595145
"171",0.654208788313884
"172",0.660737451840805
"173",0.670877640231762
"174",0.678824519431565
"175",0.685559638670552
"176",0.705743724935747
"177",0.717029557833701
"178",0.727046151438796
"179",0.789382706533032
"180",0.820371855719851
"181",0.840917374414372
"182",0.84347559150436
"183",0.854141647625248
"184",0.937691647907219
"185",0.951269155783039
"186",0.993188864450473
"187",0.99571078782074
"188",1.0296477056999
"189",1.02975766214731
"190",1.04653038076584
"191",1.07170181907345
"192",1.16132304653243
"193",1.18489323589501
"194",1.22225848385246
"","x"
"1",-5.12745738558574
"2",-3.57284980795207
"3",-2.71669930107564
"4",-2.60560419209667
"5",-2.55504550467541
"6",-2.32616497429811
"7",-2.21526681782536
"8",-2.18579498203542
"9",-2.13194980193081
"10",-2.0173645808511
"11",-1.85344567630174
"12",-1.74865423674265
"13",-1.73319441603871
"14",-1.58722759621848
"15",-1.54246999235556
"16",-1.54010993855021
"17",-1.52635124770622
"18",-1.50830118445501
"19",-1.38416524100049
"20",-1.30754621489948
"21",-1.26982901123253
"22",-1.24014588854913
"23",-1.22855425563975
"24",-1.22125703545749
"25",-1.21869156644165
"26",-1.16823822070044
"27",-1.14413410502718
"28",-1.14017116935513
"29",-1.13610689026042
"30",-1.04802315153697
"31",-1.02537382207794
"32",-0.976306575019353
"33",-0.972846565263427
"34",-0.931546138516482
"35",-0.92620360782696
"36",-0.91430785083673
"37",-0.9076059009389
"38",-0.904698858722735
"39",-0.899765459236646
"40",-0.896801278427396
"41",-0.842688842939503
"42",-0.799764915990784
"43",-0.790181807730654
"44",-0.779737875400704
"45",-0.748170819200895
"46",-0.747620964585755
"47",-0.723814001907761
"48",-0.703672974288052
"49",-0.694024296405918
"50",-0.684415927208363
"51",-0.653541620323278
"52",-0.641448178713844
"53",-0.63793961883217
"54",-0.6079988154208
"55",-0.591315169432083
"56",-0.588629908016093
"57",-0.583620846520253
"58",-0.583258354242871
"59",-0.577813482630085
"60",-0.567986061711903
"61",-0.558317776134144
"62",-0.556301995730657
"63",-0.555453167286526
"64",-0.553392357530657
"65",-0.550494800180106
"66",-0.546383128116369
"67",-0.537294918840742
"68",-0.536335026159591
"69",-0.522819114629976
"70",-0.518936902074394
"71",-0.512639113532678
"72",-0.49888843398999
"73",-0.48647741521696
"74",-0.484990569937416
"75",-0.475052220867575
"76",-0.471009614586147
"77",-0.447842094966283
"78",-0.436258733398278
"79",-0.431131286093315
"80",-0.424628131174874
"81",-0.418612978839984
"82",-0.412817097201873
"83",-0.400061819012557
"84",-0.395802282212732
"85",-0.369845170294317
"86",-0.322246276815395
"87",-0.310892416823284
"88",-0.306880696158364
"89",-0.302007392098573
"90",-0.296638423335579
"91",-0.280292137140459
"92",-0.276604822616098
"93",-0.260960584889959
"94",-0.245874968219429
"95",-0.244045715547781
"96",-0.242986120114656
"97",-0.237770488737
"98",-0.217954612049585
"99",-0.211119462441727
"100",-0.192467703255311
"101",-0.185050068943234
"102",-0.155434377987752
"103",-0.142675340685898
"104",-0.131478995778401
"105",-0.120968994554261
"106",-0.112175632157977
"107",-0.111865603631534
"108",-0.110611840177199
"109",-0.0987745018280409
"110",-0.0957956330211523
"111",-0.0813523480106355
"112",-0.0809683732279013
"113",-0.0715256913526965
"114",-0.0705427149337193
"115",-0.0566829697641671
"116",-0.0552884389356196
"117",-0.0490581038758615
"118",-0.0331038749290681
"119",-0.0193785907514093
"120",-0.00104669938711808
"121",0.00593942552902084
"122",0.0162704918493848
"123",0.0290742721481726
"124",0.0297798221926759
"125",0.0391169032653739
"126",0.0489324115119895
"127",0.0662036014753268
"128",0.0814329533855254
"129",0.0869105344688676
"130",0.0887654630633744
"131",0.0914462986434958
"132",0.091846660320617
"133",0.108311037655672
"134",0.115100959183187
"135",0.119704456326755
"136",0.120097049422945
"137",0.123666265115735
"138",0.152223247819972
"139",0.162419603540448
"140",0.167100925574481
"141",0.169815123719659
"142",0.173090388232057
"143",0.187619004023763
"144",0.192431216292059
"145",0.199650482162789
"146",0.205375493923737
"147",0.206071563682823
"148",0.213217500436123
"149",0.213496890001305
"150",0.215498817444672
"151",0.227776260145795
"152",0.251216234373393
"153",0.257735597424298
"154",0.260218523092302
"155",0.270864487088763
"156",0.300220610567537
"157",0.305988921709446
"158",0.315071653981933
"159",0.331351514686139
"160",0.334739501199953
"161",0.34534565739046
"162",0.349233372854937
"163",0.352312574931049
"164",0.378333365508297
"165",0.379891189515099
"166",0.380841877796028
"167",0.388648918213087
"168",0.398146123561649
"169",0.411986803174549
"170",0.43437277945454
"171",0.43796043411846
"172",0.457850423577356
"173",0.469859238966312
"174",0.475246446654105
"175",0.488014540205857
"176",0.502153493707546
"177",0.508244394649783
"178",0.520269662180303
"179",0.53370166471072
"180",0.535766212062697
"181",0.560597618746085
"182",0.565696609537835
"183",0.567848747807281
"184",0.585189539932457
"185",0.58579562570861
"186",0.601663201018232
"187",0.603530562359243
"188",0.612561569793923
"189",0.615046010770534
"190",0.632395432330972
"191",0.637566153094828
"192",0.641594977461323
"193",0.646032100476025
"194",0.649426100595145
"195",0.654208788313884
"196",0.660737451840805
"197",0.670877640231762
"198",0.678824519431565
"199",0.685559638670552
"200",0.705743724935747
"201",0.717029557833701
"202",0.727046151438796
"203",0.789382706533032
"204",0.820371855719851
"205",0.840917374414372
"206",0.84347559150436
"207",0.854141647625248
"208",0.937691647907219
"209",0.951269155783039
"210",0.993188864450473
"211",0.99571078782074
"212",1.0296477056999
"213",1.02975766214731
"214",1.04653038076584
"215",1.07170181907345
"216",1.16132304653243
"217",1.18489323589501
"218",1.22225848385246
"219",1.22621741326707
"220",1.24818723039771
"221",1.25113865639064
"222",1.28832140927794
"223",1.33159828572048
"224",1.34111035765958
"225",1.34200717523738
"226",1.34503120357801
"227",1.37276232690735
"228",1.4198151401746
"229",1.43757987868062
"230",1.43961576072445
"231",1.46234411955784
"232",1.49626833193326
"233",1.64429855188976
"234",1.65594507891909
"235",1.75638998756858
"236",1.93595946146045
"237",1.97781669210289
"238",2.06192415649907
"239",2.09654146894554
"240",2.14440812801367
"241",2.22234018109923
"242",2.61886924329421
"","x"
"1",5.12745738558574
"2",3.57284980795207
"3",2.71669930107564
"4",2.60560419209667
"5",2.55504550467541
"6",2.32616497429811
"7",2.21526681782536
"8",2.18579498203542
"9",2.13194980193081
"10",2.0173645808511
"11",1.85344567630174
"12",1.74865423674265
"13",1.73319441603871
"14",1.58722759621848
"15",1.54246999235556
"16",1.54010993855021
"17",1.52635124770622
"18",1.50830118445501
"19",1.38416524100049
"20",1.30754621489948
"21",1.26982901123253
"22",1.24014588854913
"23",1.22855425563975
"24",1.22125703545749
"","x"
"1",1.22621741326707
"2",1.24818723039771
"3",1.25113865639064
"4",1.28832140927794
"5",1.33159828572048
"6",1.34111035765958
"7",1.34200717523738
"8",1.34503120357801
"9",1.37276232690735
"10",1.4198151401746
"11",1.43757987868062
"12",1.43961576072445
"13",1.46234411955784
"14",1.49626833193326
"15",1.64429855188976
"16",1.65594507891909
"17",1.75638998756858
"18",1.93595946146045
"19",1.97781669210289
"20",2.06192415649907
"21",2.09654146894554
"22",2.14440812801367
"23",2.22234018109923
"24",2.61886924329421
_______________________________________________
R-SIG-Finance@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should 
go.

Reply via email to