Hi Jay,

first: thank u very much for your comments! U made some very important points clear. I tried immediately to write directly the sample function from 

trade<-as.big.matrix(matrix(sample(c(1,-1), (N+1)*K, replace=TRUE),ncol=K), backingpath=backingpath, backingfile="trade.bin",descriptorfile="trade.desc")

into the big matrix:

trade<-big.matrix(sample(c(1,-1), (10+1), replace=TRUE),nrow=(10+1), ncol=10, type="double",backingpath="/Users/simon/Documents/R/BigMTest/", backingfile="terminaltest.bin", descriptorfile="terminaltest.desc")

But I either get only 1s:

trade[,]      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    1    1    1    1    1    1    1    1    1     1
 [2,]    1    1    1    1    1    1    1    1    1     1
 [3,]    1    1    1    1    1    1    1    1    1     1
 [4,]    1    1    1    1    1    1    1    1    1     1
 [5,]    1    1    1    1    1    1    1    1    1     1
 [6,]    1    1    1    1    1    1    1    1    1     1
 [7,]    1    1    1    1    1    1    1    1    1     1
 [8,]    1    1    1    1    1    1    1    1    1     1
 [9,]    1    1    1    1    1    1    1    1    1     1
[10,]    1    1    1    1    1    1    1    1    1     1
[11,]    1    1    1    1    1    1    1    1    1     1

or only -1s:

trade[,]      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]   -1   -1   -1   -1   -1   -1   -1   -1   -1    -1
 [2,]   -1   -1   -1   -1   -1   -1   -1   -1   -1    -1
 [3,]   -1   -1   -1   -1   -1   -1   -1   -1   -1    -1
 [4,]   -1   -1   -1   -1   -1   -1   -1   -1   -1    -1
 [5,]   -1   -1   -1   -1   -1   -1   -1   -1   -1    -1
 [6,]   -1   -1   -1   -1   -1   -1   -1   -1   -1    -1
 [7,]   -1   -1   -1   -1   -1   -1   -1   -1   -1    -1
 [8,]   -1   -1   -1   -1   -1   -1   -1   -1   -1    -1
 [9,]   -1   -1   -1   -1   -1   -1   -1   -1   -1    -1
[10,]   -1   -1   -1   -1   -1   -1   -1   -1   -1    -1
[11,]   -1   -1   -1   -1   -1   -1   -1   -1   -1    -1

Is there another possibility? In addition I found under ?as.big.matrix, for the second example the usage of matrix() inside of as.big.matrix(). But if I understood u correctly: usage is possible but does not save memory? I used the big.memory package because I always got  - using simply matrix() - exceptions, telling me, that memory has reached its limits. After using big.memory all worked fine, BUT running http://pastebin.com/UxSkzrae and  http://pastebin.com/MErGQsQd , I got this: http://pastebin.com/KrEncrSz. It seems, as there is a problem with memory allocation inside the underlying C-code, maybe a result from my matrix generation inside of the big matrix?

Any suggestions?

 

On Aug 29, 2011, at 6:24 PM, Jay Emerson wrote:

> Simon,
> 
> Though we're please to see another use of bigmemory, it really isn't
> clear that it is gaining you
> anything in your example; anything like as.big.matrix(matrix(...))
> still consumes full RAM for both
> the inner matrix() and the new big.matrix -- is the filebacking really
> necessary.  It also doesn't
> appear that you are making use of shared memory, so I'm unsure what
> the gains are.  However,
> I don't have any particular insight as to the subsequent problem with
> NeweyWest (which doesn't
> seem to be using the big.matrix objects).
> 
> Jay
> 
> ----------------------
> Message: 32
> Date: Sat, 27 Aug 2011 21:37:55 +0200
> From: Simon Zehnder <simon.zehnder@googlemail.com>
> To: r-help@r-project.org
> Subject: [R] Exception while using NeweyWest function with doMC
> Message-ID:
>       <CAGQVrP_Gk+T0oWBv1ste-y0ZAFmi9s_ZWqRxyXuGsUi18mScQA@mail.gmail.com>
> Content-Type: text/plain
> 
> Dear R users,
> 
> I am using R right now for a simulation of a model that needs a lot of
> memory. Therefore I use the *bigmemory* package and - to make it faster -
> the *doMC* package. See my code posted on http://pastebin.com/dFRGdNrG
> 
> < snip >
> -------------------------
> 
> -- 
> John W. Emerson (Jay)
> Associate Professor of Statistics
> Department of Statistics
> Yale University
> http://www.stat.yale.edu/~jay


	[[alternative HTML version deleted]]

