[R] Quantile Regression in R

Ali Hirsa ahirsa at yahoo.com
Tue Jun 29 17:26:35 CEST 2004


I recently learn about Quantile Regression in R.
I am trying to study two time series (attached) by Quantile Regression in R.
I wrote the following code and do not know how to interpret the lines.
   
What kind of information can I get from them? Correlation for quantiles, 
conditional probabilties (i.e. P(X in Quantile i | Y in Quantile i)) , and etc.
Many thanks in advance for any help.

Best,
Ali

library("quantreg")
#help.start()

Data <- read.table("RESvsMOVE2.dat")
#
x <- Data[,2]
y <- Data[,1]

par(mfrow=c(2,2))

qqnorm(x,main="MOVE Norm Q-Q Plot", xlab="Normal Qunatiles",ylab = "MOVE Quantiles")
qqline(x)

qqnorm(y,main="Residuals Norm Q-Q Plot", xlab="Normal Qunatiles",ylab = "Residuals Quantiles")
qqline(y)

plot(x,y,xlab="MOVE",ylab="Residuals",cex=.5)

xx <- seq(min(x),max(x),.5)

# Just a linear regression
g <- coef(lm(y~x))
yy <- (g[1]+g[2]*(xx))
lines(xx,yy,col="yellow")

taus <- c(.05,.1,.25,.5,.75,.9,.95)

for(tau in taus){
        f <- coef(rq(y~x,tau=tau,method="pfn"))
        yy <- (f[1]+f[2]*(xx))
        if (tau ==.05){
             lines(xx,yy,col="red")
        }
        if (tau ==.95){
             lines(xx,yy,col="green")
        }
        if (tau != .05 & tau != .95){
             lines(xx,yy,col="blue")
        }
}



		
__________________________________




More information about the R-help mailing list