我正试图在R
中运行一些分位数回归。响应变量是连续的。预测变量是分类的,取值[0, 1, 2, 3, 4]
。
每次我尝试进行任何分析时,都会收到错误消息(下面的命令和错误示例)。
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)]
结果,它甚至不让我测试预测变量之间的任何双向或三向交互。有谁知道问题可能是什么?我对R
很新,不知道发生了什么!!
编辑:我包含了一小部分数据;预测变量使用as.factor函数编码为分类
Continuous response variable and select categorical predictors