-
Notifications
You must be signed in to change notification settings - Fork 24
plr
Dr Tom August edited this page Jul 16, 2013
·
3 revisions
A function that undertakes a Power Law Residual analysis. This method compares two time periods but can take multiple time periods and will complete all pairwise comparisons. The analysis returns the standardised residuals of a linear model. The model has the log number of cells occupied in the second time period as the dependent variable and the log number of cells occupied in the first time period as the independent variable. The results are therefore a relative measure of change.
# Load the library
library(sparta)
#load example dataset
data(ex_dat)
# Passing data as an R object
plr_out <- plr(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')
The argument (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.
head(plr_out)
CONCEPT plr_1_2 plr_1_3 plr_2_3
1 Species 1 -0.96250478 -0.05908147 0.5422159
2 Species 10 -0.10893608 0.38260573 0.6172385
3 Species 11 -0.06959541 -0.69617627 NA
4 Species 12 NA NA NA
5 Species 13 -0.29504221 0.47243163 0.6205836
6 Species 14 0.44982084 -0.78746346 -1.0797575