[R] memory problems with lm
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Apr 29 16:34:37 CEST 2004
This may or may not be the same problem (which is already solved). But
please read the section on BUGS in the R FAQ and set up a reproducible
example. Then try out the current version of r-patched (one dated
tomorrow or later, to be safe) and see if the problem recurs. If it does,
please file a bug report.
My guess is that eff.fro$std.dev is a 1D array (use dim or str to find
out), and you did not intend that.
On Thu, 29 Apr 2004, Adrian Dragulescu wrote:
>
> Hello list,
>
> I've seen the recent discussions documenting problems with lm.
>
> I have encountered the following problem. I use WinXP Pro with
> service pack 1, and R 1.9.0, on a XEON 2GHz, with 1GB of RAM.
>
> > eff.fro
> std.dev mean
> NSTRDSP 7.403749e-01 1.215686e-01
> CPFGEP 9.056763e+00 1.815686e+00
> WSWOLF 4.703588e+05 1.112832e+05
> NPILGRIM 1.017640e+06 2.134335e+05
> WSNMILE 1.367312e+07 1.892021e+06
> WSHIDESL 1.830811e+07 1.892021e+06
> > reg <- lm(log(mean) ~ log(std.dev), data=eff.fro)
> Error in model.matrix.default(mt, mf, contrasts) :
> cannot allocate vector of length 1074790452
> > log(eff.fro$mean)
> [1] -2.1072763 0.5964635 11.6198339 12.2710808 14.4531561
> [6] 14.4531561
> > reg <- lm(log(eff.fro$mean) ~ log(eff.fro$std.dev))
> Error: cannot allocate vector of size 3360077 Kb
> > lef <- log(eff.fro)
> > lef
> std.dev mean
> NSTRDSP -0.3005986 -2.1072763
> CPFGEP 2.2035117 0.5964635
> WSWOLF 13.0612512 11.6198339
> NPILGRIM 13.8329973 12.2710808
> WSNMILE 16.4309427 14.4531561
> WSHIDESL 16.7228546 14.4531561
> > lef <- log(eff.fro)
> > reg <- lm(lef$mean ~ lef$std.dev)
>
> Here the my computer completely crashed. A window poped-up and said
> memory problem at address ..., and if I want to debug.
>
> I ran the same code one more time, and it worked but it did not work
> how I wanted (where is the slope?):
> > reg <- lm(lef$mean ~ lef$std.dev)
> > reg
>
> Call:
> lm(formula = lef$mean ~ lef$std.dev)
>
> Coefficients:
> (Intercept)
> 8.548
>
> >
> > summary(reg)
>
> Call:
> lm(formula = lef$mean ~ lef$std.dev)
>
> Residuals:
> 1 2 3 4 5 6
> -10.655 -7.951 3.072 3.723 5.905 5.905
>
> Coefficients:
> Estimate Std. Error t value Pr(>|t|)
> (Intercept) 8.548 2.999 2.85 0.0358 *
> ---
> Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1
>
> Residual standard error: 7.346 on 5 degrees of freedom
>
> I ran again:
>
> reg <- lm(log(mean) ~ log(std.dev), data=eff.fro)
>
> and I get the pop-up:
> The instruction at "0x6b4c45a5" referenced memory at "0x0032374a".
> The memory could not be "read". Click OK to terminate the program.
>
>
> Any ideas? Thank you,
> Adrian
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list