Skip to content

propDiff

Dr Tom August edited this page Jul 16, 2013 · 2 revisions

This function represents the simplest of the trend measures included in sparta and does not make any allowance for changes in recording behavior over time or across space. As such this is rarely a suitable method.

This simple method gives the proportional change in the number of sites occupied by comparing two time periods.

# Load the library
library(sparta)

#load example dataset
data(ex_dat)

# Run the proportional difference analysis
propDiff_out <- propDiff(Data = ex_dat,
                         time_periods = data.frame(start=c(1980,1990,2000),end=c(1989,1999,2009)),
                         min_sq = 5,
                         site_col = 'hectad',
                         sp_col = 'CONCEPT',
                         start_col = 'TO_STARTDATE',
                         end_col = 'Date')

Since this method is designed to compare two time periods, and we have provided three, the function undertakes all possible pairwise comparisons. The parameter min_sq specifies the minimum number of squares occupied in the first time period in order for a trend to be calculated for a species. This ensures that potentially inaccurate large changes are not generated. The analysis for each species is independent of all other species and the values are therefore not relative.

head(propDiff_out)

     CONCEPT propDiff_1_2 propDiff_1_3 propDiff_2_3
1  Species 1  -0.45500000   -0.7100000   -0.4678899
2 Species 10  -0.26666667   -0.5333333   -0.3636364
3 Species 11  -0.33333333   -0.6666667           NA
4 Species 12           NA           NA           NA
5 Species 13  -0.26530612   -0.6071429   -0.4652778
6 Species 14  -0.07142857   -0.7500000   -0.7307692

The output column names indicate the time periods compared and NA's indicate species time period combinations that did not meet the min_sq specified.

Clone this wiki locally