bayesQR package Error message

Asked

Viewed 57 times

2

I am trying to replicate the following example of this package "bayesQR": 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 pet develops naturally.

Why the error message?

1 answer

4


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

What this means is that you are using another function called bayesQR that’s not from the package bayesQR. If you restart R and load only 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 will be sure that you are running the function bayesQR package bayesQR.

Giving a search, it is very likely that you have uploaded the package factorQR which coincidentally has a function of the same name,, bayesQR. That way, you were calling the function factorQR::bayesQR instead of bayesQR::bayesQR and hence the error message, since the functions have different arguments.

Behold:

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)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.