[R] Question about allocMatrix error message

Phil Spector spector at stat.berkeley.edu
Wed Jul 21 23:38:29 CEST 2010


Moohwan -
    It appears that you are trying to calculate a 100000
by 100000 matrix when all you want are the diagonal 
elements.  Here's one approach that might work:

s = t(dev)%*%dev/(nr-1)
sinv = solve(s)
part = sinv%*%t(dev)
t2 = dev[,1]*part[1,] + dev[,2]*part[2,]

 					- Phil Spector
 					 Statistical Computing Facility
 					 Department of Statistics
 					 UC Berkeley
 					 spector at stat.berkeley.edu


On Wed, 21 Jul 2010, Moohwan Kim wrote:

> Dear R family,
>
> I faced a technical problem in r coding.
> #s=t(dev)%*%dev/(nr-1)         # dev (100,000 by 2) stands for
> deviation from the mean
> #sinv=solve(s)
> #t2=diag(dev%*%sinv%*%t(dev))
>
> I got an error message at t2 statement:
> Error in diag(dev %*% si %*% t(dev)) : allocMatrix: too many elements specified
>
> Please let me know if there is a way to overcome this problem.
>
> best
> moohwan
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list