SemiQRegALaD: Semiparametric quantile regression in quantile-based...

Description Usage Arguments Value References Examples

View source: R/SemiRegALaD.R

Description

The local polynomial technique is used to estimate location and scale function of the quantile-based asymmetric Laplace distribution discussed in Gijbels et al. (2019c). The semiparametric quantile estimation technique is used to estimate βth conditional quantile function in quantile-based asymmetric Laplace distributional setting discussed in Gijbels et al. (2019b) and Gijbels et al. (2019c).

Usage

1
2
3
4
5
6
locpolALaD_x0(x, y, p1 = 1, p2 = 1, h, alpha = 0.5, x0,
  tol = 1e-08)

locpolALaD(x, y, p1 = 1, p2 = 1, h, alpha = 0.5, m = 101)

SemiQRegALaD(beta, x, y, p1 = 1, p2 = 1, h, alpha = NULL, m = 101)

Arguments

x

This a conditioning covariate.

y

The is a response variable.

p1

This is the order of the Taylor expansion for the location function (i.e.,μ(X)) in local polynomial fitting technique. The default value is 1.

p2

This is the order of the Taylor expansion for the log of scale function (i.e., \ln[φ(X)]) in local polynomial fitting technique. The default value is 1.

h

This is the bandwidth parameter h.

alpha

This is the index parameter α of the quantile-based asymmetric Laplace density. The default value is 0.5 in the codes code locpolALaD_x0 and code locpolALaD. The default value of α is NULL in the code SemiQRegALaD. In this case, the α will be estimated based on the residuals of local linear mean regression.

x0

This is a grid-point x_0 at which the function is to be estimated.

tol

the desired accuracy. See details in optimize.

m

This is the number of grid points at which the functions are to be evaluated. The default value is 101.

beta

This is a specific probability for estimating βth quantile function.

Value

The code locpolALaD_x0 provides the realized value of the local maximum likelihood estimator of \widehat{θ}_{rj}(x_0) for (r\in \{1,2\}; j=1,2,...,p_r) with the estimated approximate asymptotic bias and variance at the grind point x_0 discussed in Gijbels et al. (2019c).

The code locpolALaD provides the realized value of the local maximum likelihood estimator of \widehat{θ}_{r0}(x_0) for (r\in \{1,2\}) with the estimated approximate asymptotic bias and variance at all m grind points x_0 discussed in Gijbels et al. (2019c).

The code SemiQRegALaD provides the realized value of the βth conditional quantile estimator by using semiparametric quantile regression technique discussed in Gijbels et al. (2019b) and Gijbels et al. (2019c).

References

Gijbels, I., Karim, R. and Verhasselt, A. (2019b). Quantile estimation in a generalized asymmetric distributional setting. To appear in Springer Proceedings in Mathematics & Statistics, Proceedings of ‘SMSA 2019’, the 14th Workshop on Stochastic Models, Statistics and their Application, Dresden, Germany, in March 6–8, 2019. Editors: Ansgar Steland, Ewaryst Rafajlowicz, Ostap Okhrin.

Gijbels, I., Karim, R. and Verhasselt, A. (2019c). Semiparametric quantile regression using quantile-based asymmetric family of densities. Manuscript.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
data(Hurricane)
locpolALaD_x0(Hurricane$Year, Hurricane$WmaxST, p1=1,p2=1,h=2.18,
 alpha=0.16,x0=median(Hurricane$Year))
 

data(Hurricane)
locpolALaD(Hurricane$Year, Hurricane$WmaxST, p1=1,p2=1,h=2.18, alpha=0.16)


## For Hurricane Data
data(Hurricane)
Hurricane<-Hurricane[which(Hurricane$Year>1970),]

plot(Hurricane$Year,Hurricane$WmaxST)

h=2.181082
alpha=0.1649765
gridPoints=101
fit_ALaD <-locpolALaD(Hurricane$Year, Hurricane$WmaxST, p1=1,p2=1,h=h, alpha=alpha, m = gridPoints)
str(fit_ALaD)
par(mgp=c(2,.4,0),mar=c(5,4,4,1)+0.01)

# For phi plot
plot(fit_ALaD$x0,exp(fit_ALaD$theta_20),ylab=expression(widehat(phi)(x[0])),xlab="Year",
type="l",font.lab=2,cex.lab=1.5,bty="l",cex.axis=1.5,lwd =3)

## For theta2 plot
plot(fit_ALaD$x0,fit_ALaD$theta_20,ylab=expression(bold(widehat(theta[2]))(x[0])),
xlab="Year",type="l",col=c(1), lty=1, font.lab=1,cex.lab=1.5,bty="l",cex.axis=1.3,lwd =3)



#### Estimated Quantile lines by ALaD
par(mgp=c(2.5, 1, 0),mar=c(5,4,4,1)+0.01)
# X11()
plot(Hurricane$Year, Hurricane$WmaxST, xlab = "Year",ylim=c(20,210),
ylab = "Maximum Wind Spreed",font.lab=1,cex.lab=1.3,bty="l",pch=20,cex.axis=1.3)

lines(fit_ALaD$x0,fit_ALaD$theta_10, type='l',col=c(4),lty=1,lwd =3)

#####  Conditioanl Quantile line for ALaD

lines(fit_ALaD$x0,SemiQRegALaD(beta=0.50,Hurricane$Year, Hurricane$WmaxST,
p1=1,p2=1, h=h,alpha=alpha,m=gridPoints)$fit_beta_ALaD,type='l',col=c(1),lty=1,lwd =3)


lines(fit_ALaD$x0,SemiQRegALaD(beta=0.90,Hurricane$Year, Hurricane$WmaxST,
p1=1,p2=1, h=h,alpha=alpha,m=gridPoints)$fit_beta_ALaD,type='l',col=c(14),lty=1,lwd =3)
lines(fit_ALaD$x0,SemiQRegALaD(beta=0.95,Hurricane$Year, Hurricane$WmaxST,
p1=1,p2=1, h=h,alpha=alpha,m=gridPoints)$fit_beta_ALaD,type='l',col=c(19),lty=1,lwd =3)

# Add local linear mean regression line
library(locpol)
fit_mean<-locpol(WmaxST~Year, data=Hurricane,kernel=gaussK,deg=1,
xeval=NULL,xevalLen=101)

lines(fit_mean$lpFit[,1], fit_mean$lpFit[,2],type='l',col=c(2),lty=1,lwd =3)
axis(1, at = c(1975, 1985, 1995,2005,2015),cex.axis=1.3)
axis(2, at = c(25, 75, 125,175),cex.axis=1.3)

legend("topright", legend = c(expression(beta==0.1650), expression(beta==0.50),
"Mean line",expression(beta==0.90), expression(beta==0.95)), col = c(4,1,2,14,19),
 lty=c(1,1,1,1,1), inset = 0, lwd = 3,cex=1.2)

QBAsyDist documentation built on Sept. 4, 2019, 1:05 a.m.