Skip to content
/ bfast Public
forked from janverbesselt/bfast

bfast package is now further developed on Github (migrated from svn R-Forge on 2/12/2016)

Notifications You must be signed in to change notification settings

appelmar/bfast

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bfast

This fork aims at reducing computation times in the R package bfast. Parts of the improvements rely on modifications of the strucchange package (see here). You can install both packages with:

library(devtools)
install_github("appelmar/strucchange")
install_github("appelmar/bfast")

Use package optimizations

By default, the package will not make use of any modifications. Two functions change the behaviour:

set_fast_options()    # use modifications
set_default_options() # use default implementation

The example below runs the first example of the bfastmonitor() documentation for both settings.

library(bfast)
NDVIa <- as.ts(zoo(som$NDVI.a, som$Time))
f <- function() bfastmonitor(NDVIa, start = c(2010, 13)) 

set_default_options()
x = f() 
system.time(replicate(100, f()))

set_fast_options()
y = f()
system.time(replicate(100, f()))

par(mfrow = c(1,2))
plot(x) ; plot(y)

Generate evaluation reports

The package comes with R Markdown reports to evaluate the modifications thoroughly. The following reports can be found in inst/reports:

  • report.test.Rmd runs test cases to make sure that modifications will return equal results,
  • report.benchmark.Rmd evaluates the speedup of a set of functions, and
  • report.profiling.Rmd profiles some test functions to identify computational bottlenecks.

To generate html reports, run:

library(rmarkdown)
outdir = getwd()
rmarkdown::render(system.file("reports/report.test.Rmd",package = "bfast"),output_file = paste(outdir,"/report.test.html",sep=""))
rmarkdown::render(system.file("reports/report.benchmark.Rmd",package = "bfast"),output_file = paste(outdir,"/report.benchmark.html",sep=""))
rmarkdown::render(system.file("reports/report.profiling.Rmd",package = "bfast"),output_file = paste(outdir,"/report.profiling.html",sep=""))

Notice that generating the last two reports might take some time.

Details

Most important modifications include:

  • using RcppArmadillo for computationally intensive operations in strucchange
  • avoiding expensive calls of model.frame() and model.matrix and using the design matrix and response vector instead of a data.frame and a formula
  • using lm.fit() instead of lm() when possible

About

bfast package is now further developed on Github (migrated from svn R-Forge on 2/12/2016)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • R 97.3%
  • C++ 2.7%