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)

 Species Time TFactor StDev Count spt est N>0.00 N>0.98
 1 Species 11 1984.5 0.349 0.148 6 6 6 327 0
 2 Species 11 1994.5 0.222 0.132 4 3 3 327 0
 3 Species 23 1984.5 0.001 0.012 1 0 0 235 0
 4 Species 23 1994.5 0.487 0.361 3 2 2 235 0
 5 Species 20 1984.5 0.265 0.068 18 16 16 984 0
 6 Species 20 1994.5 0.117 0.059 6 4 4 984 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
 1 S1 Species 11 -0.0127 25.55215 NA NA NA
 2 S10 Species 23 0.0486 -96.44570 NA NA NA
 3 S11 Species 20 -0.0148 29.63560 NA NA NA
 4 S12 Species 48 0.0272 -53.88940 NA NA NA
 5 S13 Species 38 0.0025 -4.66725 NA NA NA
 6 S14 Species 6 -0.0200 39.94700 NA NA NA
 a_std_err a_tval a_pval adj_r2 r2 F_val F_num_df F_den_df
 1 NA NA NA NA 1 NA 1 0
 2 NA NA NA NA 1 NA 1 0
 3 NA NA NA NA 1 NA 1 0
 4 NA NA NA NA 1 NA 1 0
 5 NA NA NA NA 1 NA 1 0
 6 NA NA NA NA 1 NA 1 0
 fres_trend10 Z_VAL SIG_95
 1 -11.926633 -0.6404022 FALSE
 2 62.580000 1.3455172 FALSE
 3 -13.756889 -1.6439371 FALSE
 4 31.258700 1.5288621 FALSE
 5 2.531512 0.4125053 FALSE
 6 -18.126925 -2.9585022 TRUE

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