Tool Focal Statistics
Based on its neighbourhood this tool calculates for each grid cell various statistical measures. According to Wilson & Gallant (2000) this tool was named 'Residual Analysis (Grid)' in earlier versions. 
References
- Wilson, J.P. & Gallant, J.C. [Eds.] (2000): Terrain analysis - principles and applications. New York, John Wiley & Sons, Inc.
 
- Author: O.Conrad (c) 2003
 
- Menu: Spatial and Geostatistics|Grids
 
Parameters
|   | Name | Type | Identifier | Description | Constraints | 
| Input | Grid | grid, input | GRID | - | - | 
| Output | Mean Value (*) | grid, output, optional | MEAN | - | - | 
 | Minimum Value (*) | grid, output, optional | MIN | - | - | 
 | Maximum Value (*) | grid, output, optional | MAX | - | - | 
 | Value Range (*) | grid, output, optional | RANGE | - | - | 
 | Standard Deviation (*) | grid, output, optional | STDDEV | - | - | 
 | Variance (*) | grid, output, optional | VARIANCE | - | - | 
 | Sum (*) | grid, output, optional | SUM | - | - | 
 | Difference from Mean Value (*) | grid, output, optional | DIFF | - | - | 
 | Deviation from Mean Value (*) | grid, output, optional | DEVMEAN | - | - | 
 | Percentile (*) | grid, output, optional | PERCENT | - | - | 
 | Median (*) | grid, output, optional | MEDIAN | - | - | 
 | Minority (*) | grid, output, optional | MINORITY | - | - | 
 | Majority (*) | grid, output, optional | MAJORITY | - | - | 
| Options | Grid System | grid system | PARAMETERS_GRID_SYSTEM | - | - | 
 | Include Center Cell | boolean | BCENTER | - | Default: 1 | 
 | Kernel Type | choice | KERNEL_TYPE | The kernel's shape. | Available Choices: [0] Square [1] Circle [2] Annulus [3] Sector Default: 1 | 
 | Inner Radius | integer number | KERNEL_INNER | cells | Minimum: 0 Default: 0 | 
 | Radius | integer number | KERNEL_RADIUS | cells | Minimum: 0 Default: 2 | 
 | Direction | floating point number | KERNEL_DIRECTION | degree | Minimum: -360.000000 Maximum: 360.000000 Default: 0.000000 | 
 | Tolerance | floating point number | KERNEL_TOLERANCE | degree | Minimum: 0.000000 Maximum: 180.000000 Default: 5.000000 | 
 | Weighting Function | choice | DW_WEIGHTING | - | Available Choices: [0] no distance weighting [1] inverse distance to a power [2] exponential [3] gaussian Default: 0 | 
 | Power | floating point number | DW_IDW_POWER | - | Minimum: 0.000000 Default: 2.000000 | 
 | Bandwidth | floating point number | DW_BANDWIDTH | Bandwidth for exponential and Gaussian weighting | Minimum: 0.000000 Default: 1.000000 | 
| (*) optional | 
Command-line
Usage: saga_cmd statistics_grid 1 [-GRID <str>] [-MEAN <str>] [-MIN <str>] [-MAX <str>] [-RANGE <str>] [-STDDEV <str>] [-VARIANCE <str>] [-SUM <str>] [-DIFF <str>] [-DEVMEAN <str>] [-PERCENT <str>] [-MEDIAN <str>] [-MINORITY <str>] [-MAJORITY <str>] [-BCENTER <str>] [-KERNEL_TYPE <str>] [-KERNEL_INNER <num>] [-KERNEL_RADIUS <num>] [-KERNEL_DIRECTION <double>] [-KERNEL_TOLERANCE <double>] [-DW_WEIGHTING <str>] [-DW_IDW_POWER <double>] [-DW_BANDWIDTH <double>]
  -GRID:<str>               	Grid
	grid, input
  -MEAN:<str>               	Mean Value
	grid, output, optional
  -MIN:<str>                	Minimum Value
	grid, output, optional
  -MAX:<str>                	Maximum Value
	grid, output, optional
  -RANGE:<str>              	Value Range
	grid, output, optional
  -STDDEV:<str>             	Standard Deviation
	grid, output, optional
  -VARIANCE:<str>           	Variance
	grid, output, optional
  -SUM:<str>                	Sum
	grid, output, optional
  -DIFF:<str>               	Difference from Mean Value
	grid, output, optional
  -DEVMEAN:<str>            	Deviation from Mean Value
	grid, output, optional
  -PERCENT:<str>            	Percentile
	grid, output, optional
  -MEDIAN:<str>             	Median
	grid, output, optional
  -MINORITY:<str>           	Minority
	grid, output, optional
  -MAJORITY:<str>           	Majority
	grid, output, optional
  -BCENTER:<str>            	Include Center Cell
	boolean
	Default: 1
  -KERNEL_TYPE:<str>        	Kernel Type
	choice
	Available Choices:
	[0] Square
	[1] Circle
	[2] Annulus
	[3] Sector
	Default: 1
  -KERNEL_INNER:<num>       	Inner Radius
	integer number
	Minimum: 0
	Default: 0
  -KERNEL_RADIUS:<num>      	Radius
	integer number
	Minimum: 0
	Default: 2
  -KERNEL_DIRECTION:<double>	Direction
	floating point number
	Minimum: -360.000000
	Maximum: 360.000000
	Default: 0.000000
  -KERNEL_TOLERANCE:<double>	Tolerance
	floating point number
	Minimum: 0.000000
	Maximum: 180.000000
	Default: 5.000000
  -DW_WEIGHTING:<str>       	Weighting Function
	choice
	Available Choices:
	[0] no distance weighting
	[1] inverse distance to a power
	[2] exponential
	[3] gaussian
	Default: 0
  -DW_IDW_POWER:<double>    	Power
	floating point number
	Minimum: 0.000000
	Default: 2.000000
  -DW_BANDWIDTH:<double>    	Bandwidth
	floating point number
	Minimum: 0.000000
	Default: 1.000000