Skip to content

Frescalo

Dr Tom August edited this page Aug 16, 2013 · 5 revisions

To do a frescalo analysis of the example data try the following:

# Load in the sparta package
library(sparta)

# Set your 'sinkdir', this is where output will be saved. Some results are also returned
# to your R environment
sinkdir <- getwd()

# Load the example data
data(ex_dat)

# Run the frescalo analysis
fres_out<-frescalo(Data = ex_dat,
                   time_periods = data.frame(start=c(1980,1990),end=c(1989,1999)),
                   sinkdir = sinkdir,
                   site_col = 'hectad',
                   sp_col = 'CONCEPT',
                   start_col = 'TO_STARTDATE',
                   end_col = 'Date')

You will see a number of different outputs come to your console. First is the output from Frescalo itself, reporting on progress through the analysis.

[1] "loading raw data"

SAVING DATA TO FRESCALO WORKING DIRECTORY
********************


RUNNING FRESCALO
********************


C:\Program Files\R\R-3.0.0\library\sparta\exec>cd C:\Program Files\R\R-3.0.0\library\sparta\exec

C:\Program Files\R\R-3.0.0\library\sparta\exec>Frescalo_2b.exe


FRESCALO_2a - Trend_analysis using local freqs
written by Mark Hill, January-June 2011

Input limits:
Number of samples = 10000
Number of species = 10000
Number of time periods = 100
Number of observations = 9999999
Number of neighbourhood weights = 5000000

...
...
...

Then you will get reporting on the progress made through the generation of output files.

Building Species List - Complete
Outputting Species Results
Species 1 of 55 - Species 1 - 15/07/2013 09:40:22
Species 2 of 55 - Species 10 - 15/07/2013 09:40:22
Species 3 of 55 - Species 11 - 15/07/2013 09:40:22
Species 4 of 55 - Species 12 - 15/07/2013 09:40:22
Species 5 of 55 - Species 13 - 15/07/2013 09:40:22
Species 6 of 55 - Species 14 - 15/07/2013 09:40:22
Species 7 of 55 - Species 15 - 15/07/2013 09:40:22
Species 8 of 55 - Species 16 - 15/07/2013 09:40:22
Species 9 of 55 - Species 17 - 15/07/2013 09:40:22
Species 10 of 55 - Species 18 - 15/07/2013 09:40:22

...
...
...

Since every dataset is different there are arguments in frescalo that allow you to specify which columns are your date, species, site, etc. There is also flexibility as to whether each observation has a known year (use 'year_col') or whether observations are associated with a year range (use 'start_col' and 'end_col'). The frescalo function takes a time_periods argument which states the time periods we want to compare (you can use more than two). These time periods are given in a dataframe with start year in the first column and end year in the second column. In this example we compare two time periods (1980-1989 & 1990-1999). The function uses these years to group records for analysis ensuring that both start_coland end_col (if used) fall into one of the defined time periods.

The function you just ran returned a 'frescalo' class object to 'fres_out', try some of these methods:

print(fres_out)
head(fres_out)

# plot() on a frescalo object produces a nice summary graphic
# but currently this only works for UK national grid data using
# hectads. We are working to produce a more general method.
plot(fres_out)

print() (and summary()) provide a summary of the frescalo analysis undertaken, while head provides a preview of each element in the object that is returned. The graphs created by plot() provide some useful information: Top left is a map of the number of species in each gridcell, taken from the raw data. Top right is the re-scaled number of species, taking into account the uneven recording effort in the raw data. Bottom left is the distribution of recording effort (white = high effort, red = low effort). Bottom right is a histogram of species trends. The blue line represents no change with species to the right increasing. The red line is a fitted density function. Note that currently this will only function with UK grid reference data

The full results can be found in the elements of 'fres_out' (shown below), fres_out$trend, fres_out$freq, fres_out$stat and fres_out$lm_stats. Additionally fres_out$log contains information from frescalo's log file and fres_out$path gives the file path to where these are saved (within the working directory you specified earlier). For more details on these elements take a look at the frescalo help file (enter '?frescalo' into the R console).

head(fres_out$trend)

1  Species 1 1984.5   0.629 0.051   200 185.1 185.1   1770     20
2  Species 1 1994.5   0.435 0.047   109 101.0 101.0   1770     15
3 Species 18 1984.5   0.163 0.126     4   2.0   2.0    238      0
4 Species 18 1994.5   0.187 0.152     2   2.0   2.0    238      0
5 Species 19 1984.5   0.305 0.117     7   7.0   7.0    396      0
6 Species 19 1994.5   0.111 0.080     2   2.0   2.0    396      0

 head(fres_out$freq)

 Location Species Pres Freq Freq1 SDFrq1 Rank Rank1
 1 HP40 Species 3 0 0.0005 0.8907 NA 1 0.828
 2 HP40 Species 42 0 0.0001 0.3179 867.5602 2 1.655
 3 HP50 Species 3 0 0.0034 0.7717 9.7492 1 1.240
 4 HP50 Species 42 0 0.0001 0.0345 0.7183 2 2.480
 5 HP51 Species 3 0 0.0026 0.7856 24.3282 1 1.194
 6 HP51 Species 42 0 0.0001 0.0519 1.1333 2 2.388

 head(fres_out$stat)

 Location Loc_no No_spp Phi_in Alpha Wgt_n2 Phi_out Spnum_in
 1 HP40 1 0 0.000 999.99 29.25 0.74 0
 2 HP50 2 0 0.003 427.77 31.67 0.74 0
 3 HP51 3 0 0.003 587.51 30.50 0.74 0
 4 HP60 4 0 0.003 532.71 34.30 0.74 0
 5 HP61 5 0 0.003 414.56 35.10 0.74 0
 6 HP62 6 0 0.004 355.69 25.00 0.74 0
 Spnum_out Iter
 1 1.2 10
 2 0.8 33
 3 0.8 33
 4 0.8 32
 5 0.8 32
 6 0.9 31

 head(fres_out$lm_stats)

    SPECIES       NAME       b         a b_std_err b_tval b_pval a_std_err a_tval
 1       S1  Species 1 -0.0194  39.12830        NA     NA     NA        NA     NA
 12      S2 Species 10  0.0015  -2.73375        NA     NA     NA        NA     NA
 23      S3 Species 11 -0.0127  25.55215        NA     NA     NA        NA     NA
 34      S4 Species 12 -0.0278  55.44710        NA     NA     NA        NA     NA
 45      S5 Species 13 -0.0003   1.18435        NA     NA     NA        NA     NA
 52      S6 Species 14  0.0064 -12.55280        NA     NA     NA        NA     NA
    a_pval adj_r2 r2 F_val F_num_df F_den_df   Ymin   Ymax       Z_VAL SIG_95
 1      NA     NA  1    NA        1        0 1984.5 1994.5 -2.79723653   TRUE
 12     NA     NA  1    NA        1        0 1984.5 1994.5  0.23198034  FALSE
 23     NA     NA  1    NA        1        0 1984.5 1994.5 -0.64040216  FALSE
 34     NA     NA  1    NA        1        0 1984.5 1994.5 -1.95774648  FALSE
 45     NA     NA  1    NA        1        0 1984.5 1994.5 -0.03984798  FALSE
 52     NA     NA  1    NA        1        0 1984.5 1994.5  1.03011645  FALSE
     change_10yr
 1   -6.29914826
 12   0.59882828
 23  -4.82190315
 34 -11.03196266
 45  -0.09736837
 52   2.68694210 

If plot_fres is set to TRUE a .pdf with species specific results is also produced however this currently only work with UK grid data (we are working on generalising this feature). If you use the plot_fres feature your maps will be saved here: ~/Maps_Results/Standard Frescalo Plots.pdf'. The first page of the .pdf shows the summary statistics for all species. Subsequent pages show the distribution, neighbourhood frequency, adjusted frequency and time factor plot for each species included in the analysis.


###References

Hill, M.H. (2011) Local frequency as a key to interpreting species occurrence data when recording effort is not known. Methods in Ecology & Evolution, 3 (1), 195-205.

Clone this wiki locally