Calculate fractal dimension using the surface area method

fd_area(data, lvec = NULL, keep_data = FALSE, plot = FALSE, scale = FALSE)

Arguments

data

DEM of class "RasterLayer" or mesh of class "mesh3d".

lvec

Vector of scales to use for calculation.

keep_data

Logical. Keep data? Default is FALSE.

plot

Logical. Plot surface with area resolutions superimposed? Defaults to FALSE.

scale

Logical. Rescale height values to fit the extent? Only relevant for DEMs. Defaults to FALSE.

Value

A value for fractal dimension, typically between 2 and 3 or a list if keep_data = TRUE.

Details

This function calculates fractal dimension using the area method. Based on values in lvec, the DEM or mesh is reprojected to varying scales. Fractal dimension is defined as 2 - s with s being the slope of the regression between the log-transformed surface areas across scales and the log-transformed scales. Considerate bias is introduced if scales approach the extent of the object due to an edge effect. Therefore, this approach is only appropriate when the object is large relative to the scales of interest to be used as lvec. Diagnostic plots may help visualize whether bias is present for the scales chosen (i.e. points do not fall on a straight line).

Examples

fd_area(horseshoe, lvec = c(0.125, 0.25, 0.5))
#> [1] 2.161903

# Look at diagnostic plot
fdata <- fd_area(horseshoe, lvec = c(0.05, 0.1, 0.2, 0.4), keep_data = TRUE)
fd_diagnose(fdata)

#> $D
#> [1] 2.183857
#> 
#> $data
#>      l      area
#> 1 0.05 103.11368
#> 2 0.10  90.03619
#> 3 0.20  78.76614
#> 4 0.40  70.49969
#> 
#> $lvec
#> [1] 0.05 0.10 0.20 0.40
#> 
#> $D_vec
#> [1] 2.195659 2.192929 2.159959
#> 
#> $var
#> [1] 0.01987056
#> 
#> $method
#> [1] "area"
#> 
# points fall on straight line

fdata <- fd_area(horseshoe, lvec = c(0.5, 1, 2, 4), keep_data = TRUE)
fd_diagnose(fdata)

#> $D
#> [1] 2.034024
#> 
#> $data
#>     l     area
#> 1 0.5 68.85680
#> 2 1.0 65.63905
#> 3 2.0 64.36724
#> 4 4.0 64.06755
#> 
#> $lvec
#> [1] 0.5 1.0 2.0 4.0
#> 
#> $D_vec
#> [1] 2.069045 2.028228 2.006733
#> 
#> $var
#> [1] 0.03165138
#> 
#> $method
#> [1] "area"
#> 
# points fall on hollow curve, indicating that lvec includes values that
# are too high.