[R] memory problems with lm
Adrian Dragulescu
adrian_d at eskimo.com
Thu Apr 29 16:25:08 CEST 2004
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
More information about the R-help
mailing list