quantreg

quantile regression+ dummy variable

▼魔方 西西 提交于 2021-02-07 07:01:23
问题 I used the quantreg package in R to compute the quantile regression model. In the model, dependent Variable(Y) is NAS_DELAY , and the independent variable(Xs) are SEANSON1TO4 , SEANSON2TO4 , SEANSON3TO4 . The model is: NAS_DELAY=aSEANSON1TO4+bSEANSON2TO4+cSEANSON3TO4+d The SEANSON1TO4 , SEANSON2TO4 , SEANSON3TO4 are dummy variables, 0 or 1. I use R to compute the intercept and other regression coefficient, but the result showed that "error in rq.fit.br(x,y,tau=tau,....)singular design matrix

Error in summary quantreg backsolve

陌路散爱 提交于 2020-06-25 10:23:34
问题 When I run a quantile regression in R, using the quantreg package, and then I run summary(quantregObject) , I get this error message: Error in base::backsolve(r, x, k = k, upper.tri = upper.tri, transpose = transpose, : singular matrix in 'backsolve'. First zero in diagonal [1] Any suggestion how could I fix this problem? 回答1: In short, try: summary(quantregObject, se = "iid") which puts a strong assumption on your residuals. Or if you need accuracy use a boot strap to get the standard errors

Using .Fortran() from R package with error saying function not available

◇◆丶佛笑我妖孽 提交于 2020-01-24 00:55:14
问题 I tried the following codes: library(quantreg) # to load the package library(foreign) # to load the package .Fortran("rqfn", PACKAGE = "quantreg") but I get the following error: Error in .Fortran("rqfn", PACKAGE = "quantreg") : "rqfn" not available for .Fortran() for package "quantreg" I have installed Rtools. But it does not solve the problem. I also checked the issues concerning system paths (as in this site: https://github.com/stan-dev/rstan/wiki/Install-Rtools-for-Windows), but there is

R Package quantreg: Extract p-values

风格不统一 提交于 2019-12-19 20:36:29
问题 I have a data series of around 250 annual maximum rainfall measurements, maxima[,] and want to apply quantile regression to all series at once and obtain the significance of each regression model in R. library(quantreg) qmag <- array(NA, c(250,4)) taus <- c(0.05, 0.1, 0.95, 0.975) for(igau in 1:250){ qure <- rq(maxima[,igau+1]~maxima[,1], tau=taus) qmag[igau,] <- coef(qure)[2,] } I've tried summary(qure, se="boot")$p.value ci(qure) and other similar variations but get NULL values. Is it

R Package quantreg: Extract p-values

自作多情 提交于 2019-12-19 20:36:25
问题 I have a data series of around 250 annual maximum rainfall measurements, maxima[,] and want to apply quantile regression to all series at once and obtain the significance of each regression model in R. library(quantreg) qmag <- array(NA, c(250,4)) taus <- c(0.05, 0.1, 0.95, 0.975) for(igau in 1:250){ qure <- rq(maxima[,igau+1]~maxima[,1], tau=taus) qmag[igau,] <- coef(qure)[2,] } I've tried summary(qure, se="boot")$p.value ci(qure) and other similar variations but get NULL values. Is it

How to add a column of fitted values to a data frame by group?

泄露秘密 提交于 2019-12-14 02:49:37
问题 Say I have a data frame like this: X <- data_frame( x = rep(seq(from = 1, to = 10, by = 1), 3), y = 2*x + rnorm(length(x), sd = 0.5), g = rep(LETTERS[1:3], each = length(x)/3)) How can I fit a regression y~x grouped by variable g and add the values from the fitted and resid generic methods to the data frame? I know I can do: A <- X[X$g == "A",] mA <- with(A, lm(y ~ x)) A$fit <- fitted(mA) A$res <- resid(mA) B <- X[X$g == "B",] mB <- with(B, lm(y ~ x)) B$fit <- fitted(mB) B$res <- resid(mB) C

Plotting Quantile regression with full range in ggplot using facet_wrap

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 18:45:07
问题 So I would like to plot entire full range quantile lines in full range when using facet_wrap . The code goes as follows: library(tidyverse) library(quantreg) mtcars %>% gather("variable", "value", -c(3, 10)) %>% ggplot(aes(value, disp)) + geom_point(aes(color = factor(gear))) + geom_quantile(quantiles = 0.5, aes(group = factor(gear), color = factor(gear))) + facet_wrap(~variable, scales = "free") #> [multiple warnings removed for clarity] Created on 2019-12-05 by the reprex package (v0.3.0)

Unable to use RAM memory in quantreg

不羁的心 提交于 2019-12-11 18:39:59
问题 I'm trying to run quantreg with 2 independent variables over the 12 555 029 cases. I have 16GB RAM on computer, 64Bit OS. Command memory.limit() returned 16 264 . Command sessionInfo() returned: R version 3.5.2 (2018-12-20) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 x64 (build 9200) Matrix products: default locale: [1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 [3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C [5] LC_TIME

Plotting quantile regression by variables in a single page

早过忘川 提交于 2019-12-11 07:39:59
问题 I am running quantile regressions for several independent variables separately (same dependent). I want to plot only the slope estimates over several quantiles of each variable in a single plot. Here's a toy data: set.seed(1988) y <- rnorm(50, 5, 3) x1 <- rnorm(50, 3, 1) x2 <- rnorm(50, 1, 0.5) # Running Quantile Regression require(quantreg) fit1 <- summary(rq(y~x1, tau=1:9/10), se="boot") fit2 <- summary(rq(y~x2, tau=1:9/10), se="boot") I want to plot only the slope estimates over quantiles.

Quantile regression and p-values - getting more decimal places

故事扮演 提交于 2019-12-07 11:27:29
问题 Using R, and package quantreg , I am performing quantile regression analyses to my data. I can get access to the p-values using the se (standard error) estimator in the summary function, as below, however I only get 5 decimal places, and would like more. model <- rq(outcome ~ predictor) summary(model, se="ker") Call: rq(formula = outcome ~ predictor) tau: [1] 0.5 Coefficients: Value Std. Error t value Pr(>|t|) (Intercept) 78.68182 2.89984 27.13312 0.00000 predictor 0.22727 0.03885 5.84943 0