[R] How to solve error : "cannot allocate vector of size 1208235 Kb"

Roger Bivand Roger.Bivand at nhh.no
Fri Feb 11 13:02:53 CET 2005


On Fri, 11 Feb 2005, Kum-Hoe Hwang wrote:

> Howdy R gurus !
> 
> I am newbie to R
> I use R 2.0.1 in Windows XP. When I run R
> I got the follwoing memory error.
> My physical memory size is 3 Gb.
> My R got the memory problem when it reached to 
> about 2 Gb.

This is not a question just about memory but also about methods. The
number of rows in sfr.data is sufficiently large (about 35000?) that the
NxN matrices being used need a lot of room. That is why the function
provides the "SparseM" method to cater for your situation (unless you have
chosen a representation of neighbour weights that is not similar to
symmetric). 

If you choose a symmetric or similar to symmetric representation, you can
use the "SparseM" method, which, as its name suggests, uses sparse
matrices. All of this is described in help(lagsarlm). 

It is also quite possible that the last 95% of your data add almost no new
information, so you could also consider choosing a subset for analysis, in
which case the "eigen" method using dense matrices should work.

> 
> Thanks in advance,
> 
> 
> > library(spdep)
> > sfr.lagsarlm <- lagsarlm(sfr.data$Bldgsqft ~ sfr.data$Ncounty + sfr.data$Nugb + sfr.data$Ngroup, data=sfr.data, listw=sfr.listw, method="eigen") 
> Error: cannot allocate vector of size 1208235 Kb
> > memory.size(max=FALSE)
> [1] 17862584
> > memory.limit(size=NA)
> [1] 3145728000
> > 
> 
> 
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand at nhh.no




More information about the R-help mailing list