# Multifractals in Ecology Using R - Day 2

## Cumulative distributions and ranks

• We want to make a plot of the cumulative distribution of a function $$P(x)$$ the frequency of words in a text.

• The cumulative distribution of the frequency is defined such that $$P(x)$$ is the fraction of words with frequency greater than or equal to $$x$$.

• If $$x$$ is the frequency of the most frequent word, usually “the”, then there is exactly one word with frequency greater than or equal to $$x$$.

Similarly for the second most frequent word, usually “of”, there are two words with frequency greater than or equal: “of” and “the”.

## Cumulative distributions and ranks 1

• In general if we rank the words in descending order then by definition there are n words with frequency greater than or equal than that of the nth most commond word.

Thus the cumulative distribution $$P(x)$$ is proportional to the rank n of a word.

Then to plot $$P(x)$$ we only need to plot the ranks as a function of the frequency.

## Cumulative distributions and fractal dimension

• We can analyze the data from Metzler (1992)

## Cumulative distributions and fractal dimension 1

• If $$B$$ is the exponent then $$H = 2 - 2B$$

The patches are persistent because H=1.18 > 0.5

• We need to install the package “car” to test for autocorrelation with the Durbin-Watson statistic. We can do this using the RStudio menu Tools/Install Packages.
we can draw a grid to determine the break point.

## Exercise 1

• Split the data in two to obtain two fractal dimensions without correlation

• There is a shorcut for doing this: the package “segmented” fits a broken line and finds the break point.

## Exercise 1 (Cont.)

• Let’s do a function to calculate H

• small patches are persistent
Big patches are anti-persistent
• What is the breakpoint value in ha? Let’s do another function.

## Conclusion

• small patches: if they are growing they keep growing, if they are reducing they vanish.

• big patches: if they are growing they will reduce, if they are reducing they will grow.

• Thus big patches are more stable, small patches appear and disappear.

## Exercise 2

• Let’s do the same thing using segmented with the 1985 data: “patch1985.dat”

• We can do a plot with the segmented object
• We can use the functions:

## A different graphic analysis

• Using graphics package “ggplot2”. We need to add both datasets in one data frame

## More questions

• This seems a fragmentation process the frequency of small patches increases but the scaling of big patches seems similar, have big patches different scalings?