BayesQR package Error message

2

I'm trying to replicate the following example of this "bayesQR" package: bayesQR

set.seed(66)
n <- 200
X <- runif(n=n,min=0,max=10)
X <- X
y <- 1 + 2*X + rnorm(n=n, mean=0, sd=.6*X)
# Estimate series of quantile regressions with adaptive lasso
out <- bayesQR(y~X, quantile=c(.05,.25,.5,.75,.95), alasso=TRUE, ndraw=5000)

However, I get the following message:

Error in bayesQR(y ~ X, quantile = c(0.05, 0.25, 0.5, 0.75, 0.95), alasso = TRUE,  : 
  unused arguments (quantile = c(0.05, 0.25, 0.5, 0.75, 0.95), alasso = TRUE, ndraw = 5000)

When I do

out <- bayesQR(y~X, .5) 

The estimation develops naturally.

Why the error message?

    
asked by anonymous 27.10.2015 / 14:59

1 answer

4

The message is that the arguments quantile , alasso , and ndraw are not part of the bayesQR function.

What this means is that you are using another function called bayesQR which is not of the bayesQR package. If you restart R and only load the package bayesQR and run the example again it will work normally. Or you can run your code as follows:

out <- bayesQR::bayesQR(y~X, quantile=c(.05,.25,.5,.75,.95), alasso=TRUE, ndraw=5000)

So you're sure to be running the bayesQR function of the bayesQR package.

Given a search, you're very likely to have loaded the factorQR package that, coincidentally, has a function with the same name, that is, bayesQR . That way, you were calling the function factorQR::bayesQR instead of bayesQR::bayesQR and so the error message, since the functions have different arguments.

See:

library(factorQR)
out <- bayesQR(y~X, quantile=c(.05,.25,.5,.75,.95), alasso=TRUE, ndraw=5000)
Error in bayesQR(y ~ X, quantile = c(0.05, 0.25, 0.5, 0.75, 0.95), alasso = TRUE,  : 
  unused arguments (quantile = c(0.05, 0.25, 0.5, 0.75, 0.95), alasso = TRUE, ndraw = 5000)
    
27.10.2015 / 17:27