Calculate fractal Dimension using the standard deviation method

```
fd_sd(
data,
lvec,
regmethod = "mean",
keep_data = FALSE,
plot = FALSE,
parallel = FALSE,
ncores = (parallel::detectCores() - 1)
)
```

## Arguments

- data
Digital elevation model of class RasterLayer.

- lvec
Vector of scales to use for calculation.

- regmethod
Method to use for linear regression between scale (lvec) and height range. One of `raw`

(all data), `mean`

(default) `median`

or `ends`

(minimum and maximum scale only)

- keep_data
Logical. Keep the data used for fd calculation? Defaults to FALSE.

- plot
Logical. Show plot of scales relative to data?

- parallel
Logical. Use parallel processing? Note: parallel must be installed.

- ncores
Number of cores to use when parallel = TRUE.

## Value

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

## Details

Calculates fractal dimension using the standard deviation method,
an analogue of the variation method, but using the standard deviation in height per grid cell instead of the full height range.
If `lvec`

is not specified, a default based on resolution and extent will be used.
A rule of thumb is that `lvec`

should range at least an order of magnitude.
However, large ranges also average-out fractal dimension of a surface that might have
phase transitions, and therefore a thorough exploration of height ranges is suggested using the `plot`

.
`regmethod`

specifies whether data is summarized by taking the mean or median of height ranges across scales or all data is used.
`regmethod`

"raw" is not recommended because the regression will give much more weight to the lower scales that include more points and likely underestimate D.

## Examples

```
# \donttest{
dem <- habtools::dem_crop(horseshoe, x0 = -469, y0 = 1267, L = 2, plot = TRUE)
fd_sd(dem, lvec = c(0.125, 0.25, 0.5, 1, 2))
#> [1] 2.166749
# }
```