Description Usage Arguments Details Value Note References Examples
Statistical Seasonal Trend Analysis for numeric vector or RasterStack
1 2 3 4 
data 
numeric vector, matrix or RasterStack object 
freq 
integer with the number of observations per period. See 
numFreq 
integer with the number of frequencies to employ in harmonic regression fitting.
See 
delta 
numeric (positive) controlling regularization and prevent noninvertible
hat matrix in harmonic regression model. See 
startYear 
numeric, time series initial year 
endYear 
numeric, time series last year 
intraAnnualPeriod 
character indicating seasons (wet or dry) to be considered for additional
statistical analysis. See 
interAnnualPeriod 
numeric vector indicating the number of years to be considered in STA. For instance,
1:5, indicates that the first five years will be
utilized for STA. Similarly, c(2,6,10) indicates that the second, sixth and tenth
years will be utilized for STA. See 
adhocPeriod 
numeric vector with the specific observations to be considered in additional
statistical analysis. See 
significance 
numeric in the interval (0,1) to assess statistical significance of trend analysis.

save 
logical, should STA output be saved, default is 
dirToSaveSTA 
character with full path name used to save 
numCores 
integer given the number of cores to use; pertinent when 
When the input is a matrix
, its first two columns must correspond
to geographic coordinates. For instance, the matrix resulting from applying rasterToPoints
to a RasterStack
has this format.
freq
must be either 12 (monthly observations), 23 (Landsat annual scale) or 36 (10day composite)
as this version implements STA for time series with these frequencies.
This version sets intraAnnualPeriod
to either the wetSeason
or the drySeason
of Mexico. Empirical evidence suggests that while wet season runs from May to October, dry season
runs from November to April. Should a desired STA require specific months/days, these must be
provided through adhocPeriod
.
When interAnnualPeriod
is not specified and class(data)=numeric
,
interAnnualPeriod = 1:(length(data)/freq)
; when class(data)
is either RasterStack
or matrix
, interAnnualPeriod = 1:((ncol(data)2)/freq)
.
Since adhocPeriod
defines an inter annual period "adhoc", the specific days of this adhoc
season must be known in advance and consequently, the specific timepoints (with respect to the
time series under consideration) must be provided in a numeric vector.
When save=T
, a valid dirToSaveSTA
must be provided, that is, this folder should have been
created previously. In this case, sta
's output is saved on dirToSaveSTA
. This version
saves arrays of STA of the mean, annual and semiannual parameters (along with their corresponding basic statistics)
in the file sta_matrix_output.RData
inside dirToSaveSTA
. Also, in the same directory,
the file sta_progress.txt
records the progress of the STA process.
save=T
, dirToSaveSTA
, numCores
and master
are required when data
is either a
RasterStack
or a matrix
. The aforementioned basic statistics are: mean and standard deviation
of the time series of annual maximum and minimum as well as the global minima and maxima.
When class(data)
is a numeric
, an object of class "staNumeric" containing:
data 
numeric vector 
freq 
integer with the number of observations per period 
startYear 
numeric, time series initial year 
endYear 
numeric, time series last year 
intraAnnualPeriod 
character indicating seasons (wet or dry) 
interAnnualPeriod 
numeric vector indicating the number of years considered in STA 
ts 
time series object; 
fit 
numeric vector with output of 
sta 
a list containing the following elements: 






significance 
numeric in the interval (0,1) or 
When class(data)
is a RasterStack
or a matrix
, an object of class
"staMatrix" containing:
freq 
integer with the number of observations per period 
daysUsedFit 
integer vector indicating the indices used to fit harmonic regression. see 
intervalsUsedBasicStats 
numeric vector indicating the indices used on calculation of basic statistics 
sta 
a list containg the following elements: 












STA is based on the following ideas. Let y_t denote the value of a periodic time series at timepoint t. It is wellknown that this type of observations can be modeled as:
y_t = a_0 + a_1 cos( (2 π t)/L  φ_1) + ... + a_K cos( (2 π K t)/L  φ_K) + \varepsilon_t, t=1,…,L.
This model is known as harmonic regression. L denotes the number of observations per period, K is the number of harmonics included in the fit, a_i's and φ_i's are called amplitude coefficients and phase angles, respectively. K can be known empirically. Amplitudes and phase angle can be obtained as the solution of a leastsquares problem.
In vegetation monitoring, amplitudes and phase angles are known as shape parameters. In particular,
a_0, a_1 and a_2 are called mean and annual and semiannual amplitudes, respectively.
Applying the harmonic regression model to observations over P periods of length L each, results
in estimates of shape parameters for each period. Thus, focusing only on amplitudes, sta
yields
time series of mean, annual and semiannual parameters. A subsequent MannKendall test for trend is performed
on each of these series.
Eastman, R., Sangermano, F., Ghimine, B., Zhu, H., Chen, H., Neeti, N., Cai, Y., Machado E., Crema, S. (2009). Seasonal trend analysis of image time series, International Journal of Remote Sensing, 30(10), 2721–2726.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39  sta_marismas < sta(data=marismas, freq=36)
str(sta_marismas)
plot(sta_marismas)
plot(sta_marismas, significance=0.09)
# Use of interAnnualPeriod
sta_21016 < sta(data = marismas, freq = 36, interAnnualPeriod = c(2, 10, 16))
plot(sta_21016)
# Use of intraAnnualPeriod
sta_drySeason_218 < sta(data = marismas, freq = 36,
interAnnualPeriod = 2:18, intraAnnualPeriod = "drySeason")
plot(sta_drySeason_218)
# Use of adhocPeriod and significance
adhoc < list()
beginPeriod < (1:17) * 36
endPeriod < 2:18 * 36
adhoc$partial < c( sapply(1:length(beginPeriod),
function(s) c(beginPeriod[s]+1, endPeriod[s]) ) )
adhoc$full < c( sapply(1:length(beginPeriod),
function(s) (beginPeriod[s]+1):endPeriod[s]) )
sta_adhoc_218 < sta(data = marismas, freq = 36, interAnnualPeriod = 2:18,
startYear = 2000, endYear = 2018, adhocPeriod = adhoc, significance=0.05)
plot(sta_adhoc_218)
# Use of ndmi RasterStack
ndmi_path = system.file("extdata", "ndmi.tif", package = "sta")
ndmiSTACK < stack(ndmi_path)
dir.create(path=paste0(system.file("extdata", package="sta"), "/output_ndmi"),
showWarnings=F)
outputDIR = paste0(system.file("extdata", package="sta"), "/output_ndmi")
sta_ndmi_21016 < sta(data = ndmiSTACK, freq = 36,
numFreq = 4, delta = 0.2, intraAnnualPeriod = "wetSeason",
startYear = 2000, endYear = 2018, interAnnualPeriod = c(2,10,16),
save = TRUE, numCores = 5, dirToSaveSTA = outputDIR)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.