0

I'm trying to run some quantile regressions in R. The response variable is continuous. The predictor variables are categorical, taking values [0, 1, 2, 3, 4].

Every time I try to do any analysis, I get error messages (examples of commands and errors below).

summary(rq(HoursFlex ~ EnvtBenefits, tau = taus), se = "nid")
Error in base::backsolve(r, x, k = k, upper.tri = upper.tri, transpose = transpose, :
singular matrix in 'backsolve'. First zero in diagonal [5]

ggplot(data = s1, aes(EnvtBenefits, HoursFlex)) + geom_point() + geom_quantile(quantiles = taus, col = "gray") + geom_quantile(quantiles = 0.5, col = "blue") + geom_smooth(method="lm", col = 2)
Smoothing formula not specified. Using: y ~ x
Warning messages: 1: Computation failed in stat_quantile(): Singular design matrix

plot(summary(rq(HoursFlex ~ Milieu, tau = taus)))
Error in plot.window(...) : infinite axis extents [GEPretty(-inf,inf,5)]

And as a result, it's not even letting me test for any 2-way or 3-way interactions between the predictors. Does anyone know what the problem might be? I'm quite new to R and don't know what's going on!!

Edit: I'm including a small subset of the data; predictors are coded as categorical using the as.factor function

Continuous response variable and select categorical predictors

AmSr
  • 1
  • 2
  • It sounds like a data issue. Can you post a small subset of your data that still gives you these errors? – Artem Sokolov Oct 16 '17 at 15:16
  • @ArtemSokolov I've posted a subset as an image at the bottom, thanks! – AmSr Oct 18 '17 at 13:57
  • I can't replicate your error with the data you provided. I am able to run `rq( HoursFlex ~ DR_SA )` without any problems. Can you please take a look at this: https://stackoverflow.com/help/mcve – Artem Sokolov Oct 18 '17 at 14:37

0 Answers0