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