Suppose there is a sample $X\sim N(0,1)$
If I want to generate a conditional random variable $Y|X\sim U(0,1)$, how can I get this conditional sample in R?
Actually, I want to run a simulation for the Skorohod representation of quantile regression. $$Y=X^\prime\beta(U),\quad U|X\sim U(0,1)$$ So that the $\tau$th quantile linear regression coefficient is $\beta(\tau)$. I think the comment and answer below is correct.
The simulation I did is as following:
Let $U\sim U(0,1)$, $X\sim |N(0,1)|$, $\beta(u)=0.5(1+u)$.
So that if we do a quantile regression between $y$ and $x$, then the $\tau$th quantile linear regression coefficient is just $\beta(\tau)$. Note that 0.5497972643 is very close to 0.55
library("quantreg") n=10000 u=runif(n) b=0.5*(1+u) x=abs(rnorm(n)) y=x*b fit=rq(y~x,tau=0.1) > fit Call: rq(formula = y ~ x, tau = 0.1) Coefficients: (Intercept) x -0.0002284288 0.5497972643 > 1.1*0.5  0.55
Thanks for all the comments and answers!