I am new to R and I am trying to reproduce some of my Excel models in R. In this 
project I am trying to perform a Quantile Regression on two Securities. I am not 
able to get the rq() function to read the stock data I retrieve. From what I 
have read so far I think I have to provide a definition for the data to enable 
rq() to recognize it. I have not had success with this so far. I would 
appreciate advice on how to define the stock market data in a way that the 
function will recognize the data as a valid input. This is what I have so far.

Thanks,
Regards,
Ron McEwan


# Quantile Regression - Fit Stock data

# Get Library

library(quantmod)
library(quantreg)

# Get Stock Data

stk1 <- getSymbols("DD",  from="2009-12-31", auto.assign=FALSE)
stk2 <- getSymbols("GE",  from="2009-12-31", auto.assign=FALSE)

# perform quantile regression procedures

#median (l1) regression  fit for the stock data.

rq(stk1 ~ stk2,.5) 

#the 1st quartile, 
  
rq(stk1 ~ stk2,.25)  

#note that 8 of the 21 points lie exactly on this plane in 4-space! 
#this returns the full rq process

rq(stk1 ~ stk2, tau=-1)   

#ordinary sample median --no rank inversion ci

rq(rnorm(50) ~ 1, ci=FALSE)    

#weighted sample median 

rq(rnorm(50) ~ 1, weights=runif(50),ci=FALSE)  



      
	[[alternative HTML version deleted]]

