Package esreg. August 22, 2017

Similar documents
Package RTransferEntropy

Package polypoly. R topics documented: May 27, 2017

Package RATest. November 30, Type Package Title Randomization Tests

Package mcmcse. July 4, 2017

Package sscor. January 28, 2016

Package EMVS. April 24, 2018

Package covsep. May 6, 2018

Package jmcm. November 25, 2017

Package netdep. July 10, 2018

Package NlinTS. September 10, 2018

Package invgamma. May 7, 2017

Package bigtime. November 9, 2017

Package reinforcedpred

Package xdcclarge. R topics documented: July 12, Type Package

Package varband. November 7, 2016

Package FDRSeg. September 20, 2017

Package MicroMacroMultilevel

Package stability. R topics documented: August 23, Type Package

Package RZigZag. April 30, 2018

Package dhsic. R topics documented: July 27, 2017

Package gtheory. October 30, 2016

Package horseshoe. November 8, 2016

Package drgee. November 8, 2016

Package multivariance

Package HIMA. November 8, 2017

Package BGGE. August 10, 2018

Package SimSCRPiecewise

Package gwqs. R topics documented: May 7, Type Package. Title Generalized Weighted Quantile Sum Regression. Version 1.1.0

Package scpdsi. November 18, 2018

Package clogitboost. R topics documented: December 21, 2015

Package cartogram. June 21, 2018

Package esaddle. R topics documented: January 9, 2017

Package SK. May 16, 2018

Package My.stepwise. June 29, 2017

Package effectfusion

Package asus. October 25, 2017

Package goftest. R topics documented: April 3, Type Package

Package RcppSMC. March 18, 2018

Package sbgcop. May 29, 2018

Package CPE. R topics documented: February 19, 2015

Package cvequality. March 31, 2018

Package tspi. August 7, 2017

Package weightquant. R topics documented: December 30, Type Package

Package dominanceanalysis

Package OGI. December 20, 2017

Package IndepTest. August 23, 2018

Package GD. January 12, 2018

Package jaccard. R topics documented: June 14, Type Package

Package BNN. February 2, 2018

Package netcoh. May 2, 2016

Package icmm. October 12, 2017

Package sklarsomega. May 24, 2018

Package msu. September 30, 2017

Package matrixnormal

Package unbalhaar. February 20, 2015

Package SMFilter. December 12, 2018

Package HMMcopula. December 1, 2018

Package codadiags. February 19, 2015

Package ForecastCombinations

Package rbvs. R topics documented: August 29, Type Package Title Ranking-Based Variable Selection Version 1.0.

Package depth.plot. December 20, 2015

Package FinCovRegularization

Package ltsbase. R topics documented: February 20, 2015

Package noncompliance

Package BayesNI. February 19, 2015

Package gk. R topics documented: February 4, Type Package Title g-and-k and g-and-h Distribution Functions Version 0.5.

Package robustrao. August 14, 2017

Package Tcomp. June 6, 2018

Package elhmc. R topics documented: July 4, Type Package

Package monmlp. R topics documented: December 5, Type Package

Package ADPF. September 13, 2017

Package causalweight

Package factorqr. R topics documented: February 19, 2015

Package RI2by2. October 21, 2016

Package bayeslm. R topics documented: June 18, Type Package

Package MAVE. May 20, 2018

Package idmtpreg. February 27, 2018

Package platetools. R topics documented: June 25, Title Tools and Plots for Multi-Well Plates Version 0.1.1

Package MonoPoly. December 20, 2017

Package TwoStepCLogit

Package skellam. R topics documented: December 15, Version Date

Package TSF. July 15, 2017

Package baystability

Package rarhsmm. March 20, 2018

Package gma. September 19, 2017

Package BayesTreePrior

Package thief. R topics documented: January 24, Version 0.3 Title Temporal Hierarchical Forecasting

Package Grace. R topics documented: April 9, Type Package

Package MultisiteMediation

Package Delaporte. August 13, 2017

Package JointModel. R topics documented: June 9, Title Semiparametric Joint Models for Longitudinal and Counting Processes Version 1.

Package chemcal. July 17, 2018

Package cellwise. June 26, 2018

Package survidinri. February 20, 2015

Package face. January 19, 2018

Package exuber. June 17, 2018

Package darts. February 19, 2015

Package FDRreg. August 29, 2016

Package dina. April 26, 2017

Package HDtest. R topics documented: September 13, Type Package

Transcription:

Type Package Package esreg August 22, 2017 Title Joint Quantile and Expected Shortfall Regression Version 0.3.1 Date 2017-08-22 Simultaneous modeling of the quantile and the expected shortfall of a response variable given a set of covariates, see Dimitriadis and Bayer (2017) <arxiv:1704.02213>. License GPL-3 Encoding UTF-8 LazyData true Imports quantreg, Rcpp, stats Suggests GenSA LinkingTo Rcpp, RcppArmadillo RoxygenNote 6.0.1 NeedsCompilation yes Author Sebastian Bayer [aut, cre], Timo Dimitriadis [aut] Maintainer Sebastian Bayer <sebastian.bayer@uni-konstanz.de> Repository CRAN Date/Publication 2017-08-22 16:53:35 UTC R topics documented: esreg............................................. 2 esreg_twostep........................................ 4 esr_loss........................................... 5 gpl.............................................. 5 vcov.esreg.......................................... 6 vcov.esreg_twostep..................................... 7 Index 8 1

2 esreg esreg Joint Quantile and Expected Shortfall Regression Estimates a joint linear regression model for the pair (VaR, ES): Q α (Y X) = X β q ES α (Y X) = X β e esreg(formula, data, alpha, g1 = 2L, g2 = 1L, target = "rho", shift_data = TRUE, method = "ils", control = list(terminate_after = 10, max.time = 10, box = 10)) formula Formula object, e.g.: y ~ x1 + x2 +... data alpha data.frame that holds the variables. If missing the data is extracted from the environment. Probability level g1 1, 2 (see G1_fun, G1_prime_fun). Default is 1. g2 1, 2, 3, 4, 5 (see G2_curly_fun, G2_fun, G2_prime_fun). Default is 2. target shift_data method control The functions to be optimized: either the loss (rho) or the moment function (psi). Optimization of the loss function is strongly recommended. If g2 is 1, 2 or 3, we can either estimate the model without or with shifting of the Y variable. We either risk biased estimates (no shifting) or slightly different estimates due to the changed loss function (shifting). Defaults to shifting to avoid biased estimates. Iterated local search (ils) or Simulated annealing (sa). Defaults to ils for reasons of computation speed. A list with control parameters passed to either the ils or sa: terminate_after - Stop the iterated local search if there is no improvement within max_step consecutive steps. Default is 10. max.time - Maximum running time of the sa optimizer. box - Box around the parameters for the sa optimizer. Value An esreg object

esreg 3 References A Joint Quantile and Expected Shortfall Regression Framework See Also vcov.esreg for the covariance estimation and summary.esreg for a summary of the regression results Examples # Simulate data (DGP-(2) in the linked paper) set.seed(0) x <- rchisq(2000, df=1) y <- -x + (1 + 0.5 * x) * rnorm(1000) # True quantile and expected shortfall regression parameters (for alpha=0.025) alpha=0.025 true_pars <- c(-1.959964, -1.979982, -2.337803, -2.168901) # Estimate the model using the standard settings fit <- esreg(y ~ x, alpha=alpha) # Compare the different variance-covariance estimators cov1 <- vcov(object=fit, sparsity="iid", cond_var="ind") cov2 <- vcov(object=fit, sparsity="nid", cond_var="scl_n") cov3 <- vcov(object=fit, sparsity="nid", cond_var="scl_sp") print("comparison of the variance-covariance estimators") print(rbind(truth=true_pars, Estimate=coef(fit), SE_iid_ind=sqrt(diag(cov1)), SE_ind_N=sqrt(diag(cov2)), SE_ind_sp=sqrt(diag(cov3)))) # Compares estimates using different G2 functions fit1 <- esreg(y ~ x, alpha=alpha, g2=1) fit2 <- esreg(y ~ x, alpha=alpha, g2=2) fit3 <- esreg(y ~ x, alpha=alpha, g2=3) fit4 <- esreg(y ~ x, alpha=alpha, g2=4) fit5 <- esreg(y ~ x, alpha=alpha, g2=5) fits <- sapply(list(fit1, fit2, fit3, fit4, fit5), coef) colnames(fits) <- sapply(1:5, function(i) esreg:::.g_function_names(1, i)[2]) print("comparison of the five G2 functions") print(rbind(truth=true_pars, t(fits))) # Compare the M- and Z-estimator fit_m <- esreg(y ~ x, alpha=alpha, target="rho") fit_z <- esreg(y ~ x, alpha=alpha, target="psi") print("comparison of the M- and Z-estimator") print(t(cbind(truth=true_pars, M=coef(fit_m), Z=coef(fit_z))))

4 esreg_twostep esreg_twostep Two Step Quantile and Expected Shortfall Regression Estimates the expected shortfall in two steps. First a linear quantile regression, then a weighted least squares regression (see the Oracle estimator in the references for a brief explanation). This estimator is much faster than the joint estimator esreg. However, the estimates are often less precise and it is recommended primarily if one needs estimates quickly. esreg_twostep(formula, data, alpha) formula Formula object, e.g.: y ~ x1 + x2 +... data alpha References See Also data.frame that holds the variables. Can be missing. Probability level A Joint Quantile and Expected Shortfall Regression Framework vcov.esreg_twostep for the covariance estimation and summary.esreg_twostep for a summary of the regression results Examples # Simulate data (DGP-(2) in the linked paper) set.seed(0) x <- rchisq(2000, df=1) y <- -x + (1 + 0.5 * x) * rnorm(1000) # True quantile and expected shortfall regression parameters (for alpha=0.025) alpha=0.025 true_pars <- c(-1.959964, -1.979982, -2.337803, -2.168901) # Joint estimator fit_joint <- esreg(y ~ x, alpha=alpha) # Two-step estimator fit_twostep <- esreg_twostep(y ~ x, alpha=alpha) # Compare the estimates print(rbind(truth=true_pars, Joint=coef(fit_joint), Two-Step =coef(fit_twostep)))

esr_loss 5 #... and the estimation times print(c(joint=fit_joint$time, Two Step =fit_twostep$time)) esr_loss Joint Quantile and Expected Shortfall Loss Function Computes the joint (VaR, ES) loss esr_loss(r, q, e, alpha, g1 = 2L, g2 = 1L, return_mean = TRUE) r q e alpha g1 g2 return_mean Vector of returns Vector of quantiles Vector of expected shortfalls Probability level 1, 2, see G1_fun 1, 2, 3, 4, 5, see G2_curly_fun, G2_fun If TRUE returns the average tick loss, else the individual values References Fissler and Ziegel (2016) gpl Generalized Piecewise Linear Loss Function Equivalent to the tick / check loss when g is the identity function. gpl(r, q, alpha, g = function(x) x, return_mean = TRUE)

6 vcov.esreg r q alpha g return_mean Vector of returns Vector of quantiles Probability level A nondecreasing function If TRUE returns the average tick loss, else the individual values References Gneiting (2011) vcov.esreg Covariance Estimation for esreg Estimate the variance-covariance matrix of the joint (VaR, ES) estimator either using the asymptotic formulas or using the bootstrap. ## S3 method for class 'esreg' vcov(object, sparsity = "iid", cond_var = "ind", bandwidth_type = "Hall-Sheather", bootstrap_method = NULL, B = 1000, block_length = NULL,...) object sparsity cond_var An esreg object Sparsity estimator (default: iid), see density_quantile_function for more details. iid - Piecewise linear interpolation of the distribution nid - Hendricks and Koenker sandwich Conditional truncated variance estimator (default: ind), see conditional_truncated_variance for more details. ind - Variance over all negative residuals scl_n - Scaling with the normal distribution scl_sp - Scaling with the kernel density function bandwidth_type Bofinger, Chamberlain or Hall-Sheather bootstrap_method (default: NULL) NULL - Use the asymptotic estimator iid - Apply the iid bootstrap (Efron, 1979) stationary - Apply the stationary bootstrap (Politis & Romano, 1994)

vcov.esreg_twostep 7 B Number of bootstrap iterations block_length Average block length for the stationary bootstrap... additional arguments vcov.esreg_twostep Covariance Estimation for esreg_twostep Estimate the variance-covariance matrix of the joint (VaR, ES) estimator either using the asymptotic formulas or using the bootstrap. ## S3 method for class 'esreg_twostep' vcov(object, sparsity = "iid", cond_var = "ind", bandwidth_type = "Hall-Sheather", bootstrap_method = NULL, B = 1000, block_length = NULL,...) object sparsity cond_var An esreg object Sparsity estimator (default: iid), see density_quantile_function for more details. iid - Piecewise linear interpolation of the distribution nid - Hendricks and Koenker sandwich Conditional truncated variance estimator (default: ind), see conditional_truncated_variance for more details. ind - Variance over all negative residuals scl_n - Scaling with the normal distribution scl_sp - Scaling with the kernel density function bandwidth_type Bofinger, Chamberlain or Hall-Sheather bootstrap_method (default: NULL) B block_length NULL - Use the asymptotic estimator iid - Apply the iid bootstrap (Efron, 1979) stationary - Apply the stationary bootstrap (Politis & Romano, 1994) Number of bootstrap iterations Average block length for the stationary bootstrap... additional arguments

Index conditional_truncated_variance, 6, 7 density_quantile_function, 6, 7 esr_loss, 5 esreg, 2, 4 esreg_twostep, 4 G1_fun, 2, 5 G1_prime_fun, 2 G2_curly_fun, 2, 5 G2_fun, 2, 5 G2_prime_fun, 2 gpl, 5 summary.esreg, 3 summary.esreg_twostep, 4 vcov.esreg, 3, 6 vcov.esreg_twostep, 4, 7 8