[R] Long vectors error using lar function in selectiveInference package

Adam Ralph Zeilinger arz at berkeley.edu
Tue May 16 21:49:43 CEST 2017


Hello,

I'm trying to use the lar() and larInf() functions in the
selectiveInference package to fit a least-angle regression model and
calculate sequential p-values for the coefficients. However, I am getting a
"long vectors error" when I run my data set through the lar() function:

Error in qr.qy(qr, D) :
  long vectors (argument 5) are not supported in .Fortran

>From reading on-line, this seems to be commonly encountered when a function
in C or Fortran tries to manipulate a matrix that is larger than 2^31-1
elements. My predictor matrix x is 56676 rows by 31 columns, producing a
matrix smaller than the 2^31-1 limit. I'm guessing that there are some
calculations within lar() that produce a larger matrix. While the lar()
function doesn't work, the lars() function in the lars package does.
However, I'd like to use lar() to be able to also use larInf() to get
sequential p-values.

Can anyone help me understand why I'm getting this error? Any thoughts on
ways that I could use lar() with my full data set? Or alternative
suggestions?

I'm running R 3.4.0, selectiveInference v. 1.2.2 and lars v. 1.2. I've
included example code below, modified from the lar() help page to reflect
the dimensions of my predictor matrix x:


library(selectiveInference)
library(lars)

set.seed(43)
n = 56676
p = 31
sigma = 0.95 # Estimated using original data set and the estimateSigma()
function
x = matrix(rnorm(n*p),n,p)
beta = c(3,2,rep(0,p-2))
y = x%*%beta + sigma*rnorm(n)

# run LAR, plot results
larfit = lar(x,y) # Returns 'long vector error'
plot(larfit)

# compute sequential p-values and confidence intervals
# (sigma estimated from full model)
out = larInf(larfit)
out

# But lars::lars() works fine
larsfit <- lars(x = x, y = y)


Thanks in advance for the help,
Adam

-- 
Adam Zeilinger

Postdoctoral Scholar
Department of Environmental Science, Policy, and Management
University of California Berkeley
arz at berkeley.edu

	[[alternative HTML version deleted]]



More information about the R-help mailing list