0

I need to fit quantile regression to my data. I use code like this:

library(quantreg)
quantreg25 <- rq(Y ~ X, tau = 0.25)
P <- predict.rq(quantreg25, newdata=test)

However, I get error message:

Warning message:
'newdata' had 60000 rows but variables found have 30000 rows

I have 30k rows in my training set, and like 60k in test set. Scriprt works, however, it creates only 30k values, not 60k expected. How may I fit and predict Y value in the test set using quantile regression here?

lmo
  • 37,904
  • 9
  • 56
  • 69
Bear
  • 338
  • 1
  • 3
  • 11
  • Works for me. I suspect you have either something wrong with `test`, or the way you invoke `rq`. How do you create `test`? Can you show the head and the tail of it? – Ott Toomet Jan 25 '16 at 22:35
  • Can you be so kind to share how you create your datasets? I think I have problem with naming, e.g. function cant find vector to predict within test set. – Bear Jan 25 '16 at 22:40
  • Thank you. I've rerun this process with correct naming of vectors and everthing worked. Is it ok, that I have 0 values for dependent variable in test set before `predict`? – Bear Jan 25 '16 at 23:03
  • I think so, I guess only X will be used. But just test it :-) I created my test as `test <- data.frame(X=runif(200), Y=runif(200))` – Ott Toomet Jan 26 '16 at 00:03

0 Answers0