I have to implement this formula:
$K(x) = \int_{0}^{0.5}q_{\theta}(x)d{\theta}$
where $q_{\theta}(x)$´s are the conditional quantiles in some $\theta$.
using a range of $\theta = [0.45; 0.40; 0.35; 0.3; 0.25; 0.2; 0.15; 0.1; 0.05]$
Note that i am integrating in $\theta$ not in $x$.
The idea is, when im in $\theta=.05$ i automatically have $q_{.05}(x)$ through:
q_theta<-rq(Y~x,tau = .05)
and so on through in the interval $\theta = [0.45; 0.40; 0.35; 0.3; 0.25; 0.2; 0.15; 0.1; 0.05]$.
q_theta<-rq(Y~x,tau = .45)
q_theta<-rq(Y~x,tau = .35)
q_theta<-rq(Y~x,tau = .3)
q_theta<-rq(Y~x,tau = .25)
q_theta<-rq(Y~x,tau = .2)
q_theta<-rq(Y~x,tau = .15)
q_theta<-rq(Y~x,tau = .1)
And i proceed to the integration, where i have no idea how to do:
My data:
set.seed(33)
N<-100
Y<- rnorm(N,0,3)
x<- runif(N)
And then, i calculate: $K(x) = \int_{0}^{0.5}q_{\theta}(x)d{\theta}$
I hope I have been clear, otherwise I redo the question.
I dont know how to build this integral function.
Any sugestion?
Thanks.