QRSimul: Unweighted simultaneous objective function

Description Usage Arguments Value Note Author(s) References See Also Examples

Description

The etimation of conditional quantile curves using unweighted simultaneous objective function involving non-crossing constraints.

Usage

1
QRSimul(VecX, tau, times, subj, X, y, d, kn, degree, lambda, gam)

Arguments

VecX

The representative values for each covariate used to estimate the desired conditional quantile curves.

tau

The quantiles of interest.

times

The vector of the time variable.

subj

The vector of subjects/individuals.

X

The covariate matrix containing 1 as its first column (including intercept in the model).

y

The response vector.

d

The order of the differencing operator for each covariate.

kn

The number of knots for each covariate.

degree

The degree of the B-spline basis function for each covariate.

lambda

The grid for the smoothing parameter to control the trade of between fidelity and penalty term (use a fine grid of lambda).

gam

The power used in estimating the smooting parameter for each covariate (e.g. gam=1 or gam=0.5).

Value

W

The weight for each subject corresponding to the length of its repeated measurement.

alpha

The estimators of the coefficient vector of the basis B-splines.

hat_bt0

The baseline estimators.

hat_btk

The varying coefficient estimators.

qhat_h

The estimators of the τ_h-th conditional quantile curves.

Note

Some warning messages are related to the function rq.fit.sfn.

Author(s)

Yudhie Andriyana

References

Andriyana, Y., Gijbels, I., and Verhasselt, A. P-splines quantile regression estimation in varying coefficient models. Test 23, 1 (2014a),153–194.

Andriyana, Y., Gijbels, I. and Verhasselt, A. (2014b). Quantile regression in varying coefficient models: non-crossingness and heteroscedasticity. Manuscript.

See Also

rq.fit.sfn as.matrix.csr truncSP

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
64
65
66
67
68
69
70
71
72
data(PM10)

PM10 = PM10[order(PM10$day,PM10$hour,decreasing=FALSE),]

y = PM10$PM10[1:200]
times = PM10$hour[1:200]
subj = PM10$day[1:200]
dim = length(y)
x0 = rep(1,200)
x1 = PM10$cars[1:200]
x2 = PM10$wind.speed[1:200]

X = cbind(x0, x1, x2)

VecX = c(1, max(x1), max(x2))

##########################
#### Input parameters ####
##########################
kn = c(10, 10, 10)
degree = c(3, 3, 3)
taus = seq(0.1,0.9,0.1)
lambdas = c(1,1.5,2)
d = c(1, 1, 1)
gam = 1
##########################


Simul = QRSimul(VecX=VecX, tau=taus, times=times, subj=subj, X=X, y=y,
        d=d, kn=kn, degree=degree, lambda=lambdas, gam=gam)

hat_bt0 = Simul$hat_bt0
hat_btk = Simul$hat_btk
qhat = Simul$qhat

qhat1 = qhat[,1]
qhat2 = qhat[,2]
qhat3 = qhat[,3]
qhat4 = qhat[,4]
qhat5 = qhat[,5]
qhat6 = qhat[,6]
qhat7 = qhat[,7]
qhat8 = qhat[,8]
qhat9 = qhat[,9]


i = order(times, y, qhat1, qhat2, qhat3, qhat4, qhat5, qhat6, qhat7,
    qhat8, qhat9);

times = times[i]; y = y[i]; qhat1 = qhat1[i]; qhat2=qhat2[i];
qhat3=qhat3[i]; qhat4=qhat4[i]; qhat5=qhat5[i]; qhat6=qhat6[i];
qhat7=qhat7[i]; qhat8=qhat8[i]; qhat9=qhat9[i];

ylim = range(qhat1, qhat9)
ylim = c(-4, 6)
plot(qhat1~times, col="magenta", cex=0.2, lty=5, lwd=2, type="l", ylim=ylim,
xlab="hour", ylab="PM10");
lines(qhat2~times, col="aquamarine4", cex=0.2, lty=4, lwd=2);
lines(qhat3~times, col="blue", cex=0.2, lty=3, lwd=3);
lines(qhat4~times, col="brown", cex=0.2, lty=2, lwd=2);
lines(qhat5~times, col="black", cex=0.2, lty=1, lwd=2);
lines(qhat6~times, col="orange", cex=0.2, lty=2, lwd=2)
lines(qhat7~times, col="darkcyan", cex=0.2, lty=3, lwd=3);
lines(qhat8~times, col="green", cex=0.2, lty=4, lwd=2);
lines(qhat9~times, col="red", cex=0.2, lty=5, lwd=3)

legend("bottom", c(expression(tau==0.9), expression(tau==0.8),
    expression(tau==0.7), expression(tau==0.6), expression(tau==0.5),
    expression(tau==0.4), expression(tau==0.3), expression(tau==0.2),
    expression(tau==0.1)), ncol=1, col=c("red","green","darkcyan",
    "orange","black","brown","blue","aquamarine4","magenta"),
    lwd=c(2,2,3,2,2,2,3,2,2), lty=c(5,4,3,2,1,2,3,4,5))

QRegVCM documentation built on May 1, 2019, 9:11 p.m.

Related to QRSimul in QRegVCM...