R Under development (unstable) (2018-11-09 r75569) -- "Unsuffered Consequences" Copyright (C) 2018 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > pkgname <- "bigFastlm" > source(file.path(R.home("share"), "R", "examples-header.R")) > options(warn = 1) > library('bigFastlm') Loading required package: bigmemory > > base::assign(".oldSearch", base::search(), pos = 'CheckExEnv') > base::assign(".old_wd", base::getwd(), pos = 'CheckExEnv') > cleanEx() > nameEx("bigLm") > ### * bigLm > > flush(stderr()); flush(stdout()) > > ### Name: bigLm > ### Title: fast and memory efficient linear model fitting > ### Aliases: bigLm bigLm.default > > ### ** Examples > > > library(bigmemory) > > nrows <- 50000 > ncols <- 50 > bkFile <- "bigmat.bk" > descFile <- "bigmatk.desc" > bigmat <- filebacked.big.matrix(nrow=nrows, ncol=ncols, type="double", + backingfile=bkFile, backingpath=".", + descriptorfile=descFile, + dimnames=c(NULL,NULL)) > > # Each column value with be the column number multiplied by > # samples from a standard normal distribution. > set.seed(123) > for (i in 1:ncols) bigmat[,i] = rnorm(nrows)*i > > y <- rnorm(nrows) + bigmat[,1] > > system.time(lmr1 <- bigLm(bigmat, y)) big_fast_lm.cpp:282:47: runtime error: member call on address 0x612000132040 which does not point to an object of type 'BigMatrix' 0x612000132040: note: object is of type 'FileBackedBigMatrix' 01 00 80 1c b0 52 66 13 d4 7f 00 00 32 00 00 00 00 00 00 00 50 c3 00 00 00 00 00 00 50 c3 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'FileBackedBigMatrix' big_fast_lm.cpp:289:97: runtime error: member call on address 0x612000132040 which does not point to an object of type 'BigMatrix' 0x612000132040: note: object is of type 'FileBackedBigMatrix' 01 00 80 1c b0 52 66 13 d4 7f 00 00 32 00 00 00 00 00 00 00 50 c3 00 00 00 00 00 00 50 c3 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'FileBackedBigMatrix' big_fast_lm.cpp:289:82: runtime error: member call on address 0x612000132040 which does not point to an object of type 'BigMatrix' 0x612000132040: note: object is of type 'FileBackedBigMatrix' 01 00 80 1c b0 52 66 13 d4 7f 00 00 32 00 00 00 00 00 00 00 50 c3 00 00 00 00 00 00 50 c3 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'FileBackedBigMatrix' big_fast_lm.cpp:289:67: runtime error: member call on address 0x612000132040 which does not point to an object of type 'BigMatrix' 0x612000132040: note: object is of type 'FileBackedBigMatrix' 01 00 80 1c b0 52 66 13 d4 7f 00 00 32 00 00 00 00 00 00 00 50 c3 00 00 00 00 00 00 50 c3 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'FileBackedBigMatrix' bigmemory.cpp:175:41: runtime error: member call on address 0x612000132040 which does not point to an object of type 'BigMatrix' 0x612000132040: note: object is of type 'FileBackedBigMatrix' 01 00 80 1c b0 52 66 13 d4 7f 00 00 32 00 00 00 00 00 00 00 50 c3 00 00 00 00 00 00 50 c3 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'FileBackedBigMatrix' bigmemory.cpp:200:91: runtime error: member call on address 0x612000132040 which does not point to an object of type 'BigMatrix' 0x612000132040: note: object is of type 'FileBackedBigMatrix' 01 00 80 1c b0 52 66 13 d4 7f 00 00 32 00 00 00 00 00 00 00 50 c3 00 00 00 00 00 00 50 c3 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'FileBackedBigMatrix' bigmemory.cpp:200:76: runtime error: member call on address 0x612000132040 which does not point to an object of type 'BigMatrix' 0x612000132040: note: object is of type 'FileBackedBigMatrix' 01 00 80 1c b0 52 66 13 d4 7f 00 00 32 00 00 00 00 00 00 00 50 c3 00 00 00 00 00 00 50 c3 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'FileBackedBigMatrix' bigmemory.cpp:200:61: runtime error: member call on address 0x612000132040 which does not point to an object of type 'BigMatrix' 0x612000132040: note: object is of type 'FileBackedBigMatrix' 01 00 80 1c b0 52 66 13 d4 7f 00 00 32 00 00 00 00 00 00 00 50 c3 00 00 00 00 00 00 50 c3 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'FileBackedBigMatrix' bigmemory.cpp:227:41: runtime error: member call on address 0x612000132040 which does not point to an object of type 'BigMatrix' 0x612000132040: note: object is of type 'FileBackedBigMatrix' 01 00 80 1c b0 52 66 13 d4 7f 00 00 32 00 00 00 00 00 00 00 50 c3 00 00 00 00 00 00 50 c3 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'FileBackedBigMatrix' bigmemory.cpp:252:91: runtime error: member call on address 0x612000132040 which does not point to an object of type 'BigMatrix' 0x612000132040: note: object is of type 'FileBackedBigMatrix' 01 00 80 1c b0 52 66 13 d4 7f 00 00 32 00 00 00 00 00 00 00 50 c3 00 00 00 00 00 00 50 c3 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'FileBackedBigMatrix' bigmemory.cpp:252:76: runtime error: member call on address 0x612000132040 which does not point to an object of type 'BigMatrix' 0x612000132040: note: object is of type 'FileBackedBigMatrix' 01 00 80 1c b0 52 66 13 d4 7f 00 00 32 00 00 00 00 00 00 00 50 c3 00 00 00 00 00 00 50 c3 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'FileBackedBigMatrix' bigmemory.cpp:252:61: runtime error: member call on address 0x612000132040 which does not point to an object of type 'BigMatrix' 0x612000132040: note: object is of type 'FileBackedBigMatrix' 01 00 80 1c b0 52 66 13 d4 7f 00 00 32 00 00 00 00 00 00 00 50 c3 00 00 00 00 00 00 50 c3 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'FileBackedBigMatrix' user system elapsed 0.446 0.006 0.454 > > system.time(lmr2 <- lm.fit(x = bigmat[,], y = y)) user system elapsed 0.302 0.026 0.331 > > max(abs(coef(lmr1) - coef(lmr2))) [1] 5.551115e-16 > > > > > > cleanEx() > nameEx("bigLmPure") > ### * bigLmPure > > flush(stderr()); flush(stdout()) > > ### Name: bigLmPure > ### Title: fast and memory efficient linear model fitting > ### Aliases: bigLmPure > > ### ** Examples > > > library(bigmemory) > > nrows <- 50000 > ncols <- 50 > bkFile <- "bigmat2.bk" > descFile <- "bigmatk2.desc" > bigmat <- filebacked.big.matrix(nrow=nrows, ncol=ncols, type="double", + backingfile=bkFile, backingpath=".", + descriptorfile=descFile, + dimnames=c(NULL,NULL)) > > # Each column value with be the column number multiplied by > # samples from a standard normal distribution. > set.seed(123) > for (i in 1:ncols) bigmat[,i] = rnorm(nrows)*i > > y <- rnorm(nrows) + bigmat[,1] > > system.time(lmr1 <- bigLmPure(bigmat, y)) user system elapsed 0.399 0.003 0.511 > > system.time(lmr2 <- lm.fit(x = bigmat[,], y = y)) user system elapsed 0.297 0.029 0.364 > > max(abs(coef(lmr1) - coef(lmr2))) [1] 5.551115e-16 > > > > > > cleanEx() > nameEx("predict.bigLm") > ### * predict.bigLm > > flush(stderr()); flush(stdout()) > > ### Name: predict.bigLm > ### Title: Prediction method for bigLm fitted objects > ### Aliases: predict.bigLm > > ### ** Examples > > > library(bigmemory) > > nrows <- 50000 > ncols <- 50 > bkFile <- "bigmat3.bk" > descFile <- "bigmatk3.desc" > bigmat <- filebacked.big.matrix(nrow=nrows, ncol=ncols, type="double", + backingfile=bkFile, backingpath=".", + descriptorfile=descFile, + dimnames=c(NULL,NULL)) > > # Each column value with be the column number multiplied by > # samples from a standard normal distribution. > set.seed(123) > for (i in 1:ncols) bigmat[,i] = rnorm(nrows)*i > > y <- rnorm(nrows) + bigmat[,1] > > system.time(lmr1 <- bigLm(bigmat, y)) user system elapsed 0.445 0.004 0.579 > > > preds <- predict(lmr1, newdata = bigmat) bigmemory.cpp:290:42: runtime error: member call on address 0x612000148540 which does not point to an object of type 'BigMatrix' 0x612000148540: note: object is of type 'FileBackedBigMatrix' 01 00 80 1d b0 52 66 13 d4 7f 00 00 32 00 00 00 00 00 00 00 50 c3 00 00 00 00 00 00 50 c3 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'FileBackedBigMatrix' bigmemory.cpp:319:91: runtime error: member call on address 0x612000148540 which does not point to an object of type 'BigMatrix' 0x612000148540: note: object is of type 'FileBackedBigMatrix' 01 00 80 1d b0 52 66 13 d4 7f 00 00 32 00 00 00 00 00 00 00 50 c3 00 00 00 00 00 00 50 c3 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'FileBackedBigMatrix' bigmemory.cpp:319:76: runtime error: member call on address 0x612000148540 which does not point to an object of type 'BigMatrix' 0x612000148540: note: object is of type 'FileBackedBigMatrix' 01 00 80 1d b0 52 66 13 d4 7f 00 00 32 00 00 00 00 00 00 00 50 c3 00 00 00 00 00 00 50 c3 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'FileBackedBigMatrix' bigmemory.cpp:319:61: runtime error: member call on address 0x612000148540 which does not point to an object of type 'BigMatrix' 0x612000148540: note: object is of type 'FileBackedBigMatrix' 01 00 80 1d b0 52 66 13 d4 7f 00 00 32 00 00 00 00 00 00 00 50 c3 00 00 00 00 00 00 50 c3 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'FileBackedBigMatrix' bigmemory.cpp:322:20: runtime error: member call on address 0x612000148540 which does not point to an object of type 'BigMatrix' 0x612000148540: note: object is of type 'FileBackedBigMatrix' 01 00 80 1d b0 52 66 13 d4 7f 00 00 32 00 00 00 00 00 00 00 50 c3 00 00 00 00 00 00 50 c3 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'FileBackedBigMatrix' > > > > > cleanEx() > nameEx("summary") > ### * summary > > flush(stderr()); flush(stdout()) > > ### Name: summary.bigLm > ### Title: summary method for bigLm fitted objects > ### Aliases: summary.bigLm > > ### ** Examples > > > library(bigmemory) > > nrows <- 50000 > ncols <- 15 > bkFile <- "bigmat4.bk" > descFile <- "bigmatk4.desc" > bigmat <- filebacked.big.matrix(nrow=nrows, ncol=ncols, type="double", + backingfile=bkFile, backingpath=".", + descriptorfile=descFile, + dimnames=c(NULL,NULL)) > > # Each column value with be the column number multiplied by > # samples from a standard normal distribution. > set.seed(123) > for (i in 1:ncols) bigmat[,i] = rnorm(nrows)*i > > y <- rnorm(nrows) + bigmat[,1] - bigmat[,2] > > system.time(lmr1 <- bigLm(bigmat, y)) user system elapsed 0.082 0.001 0.084 > > summary(lmr1) Call: bigLm.default(X = bigmat, y = y) Residuals: Min. 1st Qu. Median 3rd Qu. Max. -4.439000 -0.675700 -0.002329 0.677500 4.246000 Estimate Std. Error t value Pr(>|t|) X1 9.9680e-01 4.4859e-03 222.2047 <2e-16 *** X2 -1.0007e+00 2.2446e-03 -445.8400 <2e-16 *** X3 7.7616e-04 1.4885e-03 0.5214 0.6021 X4 -1.6900e-03 1.1181e-03 -1.5115 0.1307 X5 5.7913e-04 8.9604e-04 0.6463 0.5181 X6 2.2804e-04 7.4898e-04 0.3045 0.7608 X7 7.6785e-05 6.3854e-04 0.1203 0.9043 X8 3.7906e-04 5.6163e-04 0.6749 0.4997 X9 -7.6598e-05 5.0023e-04 -0.1531 0.8783 X10 5.7788e-04 4.4687e-04 1.2932 0.1960 X11 5.2716e-04 4.0882e-04 1.2895 0.1972 X12 5.7818e-04 3.7528e-04 1.5406 0.1234 X13 -1.6545e-04 3.4373e-04 -0.4813 0.6303 X14 1.4112e-05 3.2135e-04 0.0439 0.9650 X15 -1.8247e-04 2.9887e-04 -0.6105 0.5415 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 1.003 on 49985 degrees of freedom Multiple R-squared: 0.8323, Adjusted R-squared: 0.8323 > > > > > > ### *