detrend-bfl

detrends with a best-fit-line

var [ grids ... ] minfrac detrend-bfl

Arguments
labeltypedescription
var variable variable to be detrended
grids grid set grid set describing domain to be detrended over
minfrac number Minimum fraction of data that must be present (i.e., fraction not indicated as missing) within the selected domain in order for the data to be used in the best-fit. If minfrac is not present, then a missing value is returned. If minfrac is not given, then the bestfit is calculated regardless of the amount of data present in the domain. (optional)
Returns
detrended-var variable detrended version of the variable

While detrending data can be statistically important, it is important to remember that you could be removing the primary signal. For example, consider

where the point is that there is a long-term trend in the CO2 levels. One can, however, easily detrend the line with

SOURCES .KEELING .MAUNA_LOA .co2  [T]detrend-bfl

which would result in

Note that if we were dealing with a multi-dimensional datasets (such as X Y T representing longitude, latitute, and time), then applying [T] detrend-bfl results in a separate line being calculated at each spatial point.