Climtrends

Download as pdf or txt
Download as pdf or txt
You are on page 1of 86

Package ‘climtrends’

September 20, 2015


Type Package
Title Statistical Methods for Climate Sciences
Version 1.0.5
Encoding UTF-8
Description Absolute homogeneity tests SNHT absolute 1-breaks, 1-break,
SD different from 1, 2-breaks, Buishand, Pettitt, von Neumann ratio and
ratio-rank, Worsley, and Craddock, Relative homogeneity tests SNHT
absolute 1-breaks, 1-break SD different from 1, 2-breaks, Peterson
and Easterling, and Vincent, Differences in scale between two groups Siegel–Tukey,
Create reference time series mean, weights/correlation, finding outliers Grubbs,
ESD, MAD, Tietjen Moore, Hampel, etc.
License GPL (>= 3)
Depends R (>= 2.7.0)
LazyData yes
Author Jose Gama [aut, cre]
Maintainer Jose Gama <rxprtgama@gmail.com>
Repository CRAN
Repository/R-Forge/Project climtrends
Repository/R-Forge/Revision 10
Repository/R-Forge/DateTimeStamp 2015-09-20 14:46:27
Date/Publication 2015-09-20 18:02:18
NeedsCompilation no

R topics documented:
AdjHomogenization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
AllfilesIEObyPathPattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
AllReadUSGS2timeseries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
annual.precipitation.totals.Madison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
BSXFUN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Buishand.Critical.Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

1
2 R topics documented:

BuishandRangeTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
CompleteMissingValuesDailyMean . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
CraddockTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
CreateReferenceSeriesFromFilesMean . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
CreateReferenceSeriesFromFilesMeanCorrelations . . . . . . . . . . . . . . . . . . . . 12
CumulativeDeviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
DailyClimatologyFromDailyData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
DistributionFreeCUSUM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
ESDstatistic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
FillDailyGapsWithSomeValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
FillYearlyGapsWithSomeValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
FindCommonPeriod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
FindOutliersESDtest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
FindOutliersGrubbsTwosided . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
FindOutliersHampel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
FindOutliersMAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
FindOutliersQuant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
FindOutliersSD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
FindOutliersTietjenMooreTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
FindOutliersTrimmedMeans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
FindOutliersZscore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
FirstMonthOfSeason . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
GetInfoHomogenization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
GetNDP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
GetShiftValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
IsLeapYear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
LastDayOfTheMonth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
LevelSignifMarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
ListContinuousDays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
ListHomogStats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
ListHomogTZ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
MedianCrossingTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
MonthlyAnomaliesFromDailyData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
MonthlyClimatologyFromDailyData . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
MonthlyFuncFromDay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
MonthTrendYearsFuncFromDay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
peaksP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Pettitt.Critical.Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
PettittTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
PlotHomog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
PlotSeriesAndRefSimple . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
PlotSeriesDifference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Rank.Von.Neumann.Ratio.Test.Critical.Values . . . . . . . . . . . . . . . . . . . . . . . 44
RankDifferenceTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
RankSumTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
ReadClimexpKnmiNL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
ReadClimexpKnmiNL12month . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
ReadCRDEC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
R topics documented: 3

ReadECAdata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
ReadEtmgegFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
ReadGHCNymd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
ReadHERTTAdailyCSV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
ReadHERTTAdmyQdaily . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
ReadMeteoSwiss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
ReadNdp040stationDat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
ReadPSMSLmonthly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
ReadUSGS2timeseries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
ReadUSHCN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
ReadYearAnd12MonthsData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
SiegelTukey . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
SNHT.Critical.Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
SNHT.TwoDifferentSDs.Critical.Values . . . . . . . . . . . . . . . . . . . . . . . . . . 58
SNHT.TwoShifts.Critical.Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
SNHTabsolute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
SNHTabsolute2SDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
SNHTabsoluteDoubleShift . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
SNHTabsoluteII . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
SNHTabsoluteTrend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
SNHTrelative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
SNHTrelative2SDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
SNHTrelativeDoubleShift . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
SNHTrelativeII . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
SNHTrelativeTrend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Sqplot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
TietjenMoore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
TrimmedMean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
TurningPointsTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
ValuesBetween2Dates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
ValuesBetween2years . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
VDTR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Von.Neumann.Ratio.Test.Critical.Values . . . . . . . . . . . . . . . . . . . . . . . . . . 76
VonNeumannRatio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
VonNeumannRatioRank . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
WetDayCount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
woOp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Worsley.Likelihood.Ratio.Test.Critical.Values . . . . . . . . . . . . . . . . . . . . . . . 80
WorsleyLikelihoodRatio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
YearFuncFromDay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
yearly.average.temperature.Turin.Milan . . . . . . . . . . . . . . . . . . . . . . . . . . 83

Index 84
4 AllfilesIEObyPathPattern

AdjHomogenization Homogenization adjustment within a certain window

Description
AdjHomogenization returns the value for homogenization adjustment within a certain window.

Usage
AdjHomogenization(dataYearSeries=NA,yearShift=NA,nYears=20, diffFlag=TRUE)

Arguments
dataYearSeries dataframe with climate data
yearShift year when the shift occured
nYears window of years to adjust
diffFlag logical TRUE=difference, FALSE=ratio

Value
homgenized data.

Author(s)
Jose Gama

AllfilesIEObyPathPattern
Read multiple IEO files

Description
AllfilesIEObyPathPattern reads multiple daily values file from IEO (Instituto Español de Oceanografia,
Spain).

Usage
AllfilesIEObyPathPattern(mypath, mypattern)

Arguments
mypath Path to search for files
mypattern Pattern to search for file names
AllReadUSGS2timeseries 5

Value
A list with the read data.

Author(s)
Jose Gama

AllReadUSGS2timeseries
Read multiple USGS files

Description
AllReadUSGS2timeseries reads multiple USGS discharge files.

Usage
AllReadUSGS2timeseries()

Arguments
none

Value
A list with the read data.

Author(s)
Jose Gama

annual.precipitation.totals.Madison
Annual precipitation totals in inches Madison (Wisconsin)

Description
annual.precipitation.totals.Madison contains the annual precipitation totals in inches from
Madison (Wisconsin) - courtesy of Madison Climate Page/State Climatology Homepage.

Usage
annual.precipitation.totals.Madison
6 BSXFUN

Format
This data frame contains 2 columns (year and precipitationInches) and 135 rows of data.

Author(s)
Jose Gama

Source
Madison Climate Page/State Climatology Homepage Annual precipitation totals in inches http:
//www.aos.wisc.edu/~sco/clim-history/stations/msn/msn-pcpn.html

References
Madison Climate Page/State Climatology Homepage Annual precipitation totals in inches http:
//www.aos.wisc.edu/~sco/clim-history/stations/msn/msn-pcpn.html

Examples
data(annual.precipitation.totals.Madison)
str(annual.precipitation.totals.Madison)

BSXFUN Apply a function to each element of 2 arrays with singleton expansion


enabled

Description
BSXFUN applies a function to each element of 2 arrays with singleton expansion enabled, clone of
MATLAB’s BSXFUN

Usage
BSXFUN(op, x, y)

Arguments
op binary function to apply to arrays x and y
x array of numeric or boolean values
y array of numeric or boolean values

Value
array of numeric or boolean values with the result of function op applied to x and y

Author(s)
Jose Gama
Buishand.Critical.Values 7

Source
Douglas M. Schwarz, 2006 Generalized Array Operations http://www.mathworks.com/matlabcentral/
fileexchange/10333-generalized-array-operations/content/genop.m

References
Douglas M. Schwarz, 2006 Generalized Array Operations http://www.mathworks.com/matlabcentral/
fileexchange/10333-generalized-array-operations/content/genop.m

Examples
#example 1
x<-matrix(c(17,24,1,8,15,23,5,7,14,16,4,6,13,20,22,10,12,19,21,3,11,18,25,2,9),
5,5,byrow=TRUE)
y<-matrix(13,1,5)
op<-'+'
BSXFUN(op,x,y)

#example 2
d1<-c(4,3,1,2)
x = array(runif(prod(d1)),d1)
d2<-c(4,1,5,2)
y = array(runif(prod(d2)),d2)
op<-'*'
BSXFUN(op,x,y)

#example 3
d1<-c(1,2,5,6,3)
x<-array(1:prod(d1),d1)
d2<-c(1,2,5,1,3,4)
y<-array(1:prod(d2),d2)
op<-'+'
BSXFUN(op,x,y)

Buishand.Critical.Values
Critical values for the Buishand test

Description
Buishand.Critical.Values contains the critical values for the Buishand test.

Usage
Buishand.Critical.Values

Format
This data frame contains 6 columns (Q90 and 7 rows (n=10, 20, 30, 40, 50, 100 and Inf) of data.
8 BuishandRangeTest

Author(s)
Jose Gama

Source
Buishand TA., 1981 The analysis of homogeneity of long-term rainfall records in the Netherlands.
KNMI Scientific Report WR 81-7, De Bilt, The Netherlands.

References
Buishand TA., 1981 The analysis of homogeneity of long-term rainfall records in the Netherlands.
KNMI Scientific Report WR 81-7, De Bilt, The Netherlands.

Examples
data(Buishand.Critical.Values)
Buishand.Critical.Values

BuishandRangeTest Buishand range absolute homogeneity test

Description
BuishandRangeTest returns the result of the Buishand range test applied to a time series.

Usage
BuishandRangeTest(dataSeries)

Arguments
dataSeries time series of climate data

Value
The result of the Buishand range test.

Author(s)
Jose Gama

Source
Wijngaard, J. B., Klein Tank, A. M. G. and Können, G. P. (2003), Homogeneity of 20th cen-
tury European daily temperature and precipitation series. Int. J. Climatol., 23: 679–692. doi:
10.1002/joc.906
CompleteMissingValuesDailyMean 9

References
Wijngaard, J. B., Klein Tank, A. M. G. and Können, G. P. (2003), Homogeneity of 20th cen-
tury European daily temperature and precipitation series. Int. J. Climatol., 23: 679–692. doi:
10.1002/joc.906

Examples
# Buishand range test for Turin 1961-2003
BuishandTurin<- BuishandRangeTest(yearly.average.temperature.Turin.Milan[,2])

# Buishand range test for Milan 1961-2003


BuishandMilan<- BuishandRangeTest(yearly.average.temperature.Turin.Milan[,3])

plot(1961:2003,BuishandTurin,type='l',col='cyan',ylim=c(-2.5,0.5),
main='Buishand range test 1961-2003',xlab='Years',ylab='Buishand value')
par(new=TRUE)
plot(1961:2003,BuishandMilan,type='l',col='magenta',ylim=c(-2.5,0.5),xlab='',ylab='')
legend("top",c('Turin','Milan'),text.col=c('cyan','magenta'))

CompleteMissingValuesDailyMean
complete missing values on a time series of daily values (mean)

Description
CompleteMissingValuesDailyMean complete missing values on a time series of daily values by
using the average of 1 or more days before or after.

Usage
CompleteMissingValuesDailyMean(dataSeries, windowBefore=1,windowAfter=1,
missingValue=-9999)

Arguments
dataSeries dataframe with climate data
windowBefore number of days before the day with missing data
windowAfter number of days after the day with missing data
missingValue value representing missing data

Value
Time series.

Author(s)
Jose Gama
10 CraddockTest

CraddockTest Craddock test

Description

CraddockTest returns the result of the Craddock test applied to a time series.

Usage

CraddockTest(yearDF, valcol1, valcol2)

Arguments

yearDF dataframe with climate data


valcol1 column with values
valcol2 column with values

Value

The result of the Craddock test.

Author(s)

Jose Gama

Source

Wijngaard, J. B., Klein Tank, A. M. G. and Können, G. P. (2003), Homogeneity of 20th cen-
tury European daily temperature and precipitation series. Int. J. Climatol., 23: 679–692. doi:
10.1002/joc.906

References

Wijngaard, J. B., Klein Tank, A. M. G. and Können, G. P. (2003), Homogeneity of 20th cen-
tury European daily temperature and precipitation series. Int. J. Climatol., 23: 679–692. doi:
10.1002/joc.906

Examples
demo(demoCraddockTest)
CreateReferenceSeriesFromFilesMean 11

CreateReferenceSeriesFromFilesMean
Create a reference series (averaging)

Description
CreateReferenceSeriesFromFilesMean creates a reference series from two or more series, using
averages.

Usage
CreateReferenceSeriesFromFilesMean(vFiles,commonPeriod=NA,refSeriesFile=NA,
wholePeriod=FALSE,deviationsFlag=FALSE)

Arguments
vFiles vector with the file names of the time series
commonPeriod user defined common period for the resulting reference series, by default the
common period to all series
refSeriesFile reference series file name
wholePeriod logical, common period=TRUE
deviationsFlag logical, raw data=TRUE, deviations=FALSE

Value
reference series or none (if the user chose a reference series file name).

Author(s)
Jose Gama

Source
Stepanek, P. 2008 AnClim - software for time series analysis Dept. of Geography, Fac. of Natural
Sciences http://www.climahom.eu/AnClim.html

References
Stepanek, P. 2008 AnClim - software for time series analysis Dept. of Geography, Fac. of Natural
Sciences http://www.climahom.eu/AnClim.html

Examples
# c_As00_o.txt, c_Hori2.txt and c_Kada2.txt are from AnClim freeware distribution
setwd(system.file('extdata/', package='climtrends'))
vFiles=c('c_As00_o.txt','c_Hori2.txt','c_Kada2.txt')
refSeries=CreateReferenceSeriesFromFilesMean(vFiles)
12 CreateReferenceSeriesFromFilesMeanCorrelations

CreateReferenceSeriesFromFilesMeanCorrelations
Create a reference series (averaging weights/correlations)

Description

CreateReferenceSeriesFromFilesMeanCorrelations creates a reference series from two or


more series, using weighted averages (correlations). CreateReferenceSeriesFromFilesMeanCorrelationsTwoseries
is for two series only, using a simpler and faster method.

Usage

CreateReferenceSeriesFromFilesMeanCorrelations(vFiles,commonPeriod=NA,
refSeriesFile=NA,wholePeriod=FALSE,useDiff=TRUE,retInfo=FALSE)

Arguments

vFiles vector with the file names of the time series


commonPeriod user defined common period for the resulting reference series, by default the
common period to all series
refSeriesFile reference series file name
wholePeriod logical, common period=TRUE
useDiff logical, raw differences=TRUE, ratios=FALSE
retInfo logical, return reference series from function=TRUE

Value

reference series or none (if the user chose a reference series file name).

Author(s)

Jose Gama

Source

Stepanek, P. 2008 AnClim - software for time series analysis Dept. of Geography, Fac. of Natural
Sciences http://www.climahom.eu/AnClim.html

References

Stepanek, P. 2008 AnClim - software for time series analysis Dept. of Geography, Fac. of Natural
Sciences http://www.climahom.eu/AnClim.html
CumulativeDeviations 13

Examples
# c_As00_o.txt, c_Hori2.txt and c_Kada2.txt are from AnClim freeware distribution
setwd(system.file('extdata/', package='climtrends'))
vFiles=c('c_As00_o.txt','c_Hori2.txt','c_Kada2.txt')
refSeries=CreateReferenceSeriesFromFilesMeanCorrelations(vFiles,retInfo=TRUE)

CumulativeDeviations cumulative deviations test (parametric test for step jump in mean)

Description

CumulativeDeviations returns the result (Q) of the cumulative deviations test (parametric test
for step jump in mean) applied to a time series. CumulativeDeviationsQR return Q, R and
abs(Q)/sqrt(N).

Usage

CumulativeDeviations(dataSeries)

Arguments

dataSeries vector with climate data

Value

The result of the cumulative deviations test.

Author(s)

Jose Gama

Source

Chiew F. and Siriwardena L., 2005 CRC for Catchment Hydrology Trend 1.0.2 User Guide, chapter
4.2.11 Rank Difference Test, pp. 21 http://www.toolkit.net.au/Tools/TREND/documentation
Kundzewicz, Z.W. and Robson, A., 2000 Detecting Trend and Other Changes in Hydrological Data.
World Climate Program - Water, WMO/UNESCO, WCDMP-45, WMO/TD 1013, Geneva, 157 pp.
Grayson, R.B., Argent, R.M., Nathan, R.J., McMahon, T.A. and Mein, R., 1996 Hydrological
Recipes: Estimation Techniques in Australian Hydrology. Cooperative Research Centre for Catch-
ment Hydrology, Australia, 125 pp.
14 DailyClimatologyFromDailyData

References
Chiew F. and Siriwardena L., 2005 CRC for Catchment Hydrology Trend 1.0.2 User Guide, chapter
4.2.11 Rank Difference Test, pp. 21 http://www.toolkit.net.au/Tools/TREND/documentation
Kundzewicz, Z.W. and Robson, A., 2000 Detecting Trend and Other Changes in Hydrological Data.
World Climate Program - Water, WMO/UNESCO, WCDMP-45, WMO/TD 1013, Geneva, 157 pp.
Grayson, R.B., Argent, R.M., Nathan, R.J., McMahon, T.A. and Mein, R., 1996 Hydrological
Recipes: Estimation Techniques in Australian Hydrology. Cooperative Research Centre for Catch-
ment Hydrology, Australia, 125 pp.

Examples
# cumulative deviations for Turin 1961-2003
cdTurin<- CumulativeDeviations(yearly.average.temperature.Turin.Milan[,2])

# cumulative deviations for Milan 1961-2003


cdMilan<- CumulativeDeviations(yearly.average.temperature.Turin.Milan[,3])

plot(1961:2003,cdTurin,type='l',col='cyan',ylim=c(0,15),
main='Cumulative deviations 1961-2003',xlab='Years',ylab='C.D.')
par(new=TRUE)
plot(1961:2003,cdMilan,type='l',col='magenta',ylim=c(0,15),xlab='',ylab='')
legend("top",c('Turin','Milan'),text.col=c('cyan','magenta'))

DailyClimatologyFromDailyData
Daily climatology

Description
DailyClimatologyFromDailyData returns the daily climatology (long-term average, for each day,
of a given variable).

Usage
DailyClimatologyFromDailyData(dataSeries,fromYear=1961,toYear=1990)

Arguments
dataSeries time series of climate data
fromYear start of the long-term average
toYear end of the long-term average

Value
Daily climatology.
DistributionFreeCUSUM 15

Author(s)
Jose Gama

Examples
# xgdcnCA008201000.dat is from ECA COLLEGEVILLE temperature
setwd(system.file('extdata/', package='climtrends'))
dailyCollegeville <- ReadGHCNymd('xgdcnCA008201000.dat')
dailyCollegevilleDailyClimatology <- DailyClimatologyFromDailyData(dailyCollegeville)

DistributionFreeCUSUM Distribution Free CUSUM (non-parametric test for step jump in


mean)

Description
DistributionFreeCUSUM returns the result of the Distribution Free CUSUM (non-parametric test
for step jump in mean) applied to a time series.

Usage
DistributionFreeCUSUM(dataSeries)

Arguments
dataSeries vector with climate data

Value
The result of the Distribution Free CUSUM test.

Author(s)
Jose Gama

Source
Chiew F. and Siriwardena L., 2005 CRC for Catchment Hydrology Trend 1.0.2 User Guide, chapter
4.2.11 Rank Difference Test, pp. 21 http://www.toolkit.net.au/Tools/TREND/documentation
Kundzewicz, Z.W. and Robson, A., 2000 Detecting Trend and Other Changes in Hydrological Data.
World Climate Program - Water, WMO/UNESCO, WCDMP-45, WMO/TD 1013, Geneva, 157 pp.
Grayson, R.B., Argent, R.M., Nathan, R.J., McMahon, T.A. and Mein, R., 1996 Hydrological
Recipes: Estimation Techniques in Australian Hydrology. Cooperative Research Centre for Catch-
ment Hydrology, Australia, 125 pp.
16 ESDstatistic

References
Chiew F. and Siriwardena L., 2005 CRC for Catchment Hydrology Trend 1.0.2 User Guide, chapter
4.2.11 Rank Difference Test, pp. 21 http://www.toolkit.net.au/Tools/TREND/documentation
Kundzewicz, Z.W. and Robson, A., 2000 Detecting Trend and Other Changes in Hydrological Data.
World Climate Program - Water, WMO/UNESCO, WCDMP-45, WMO/TD 1013, Geneva, 157 pp.
Grayson, R.B., Argent, R.M., Nathan, R.J., McMahon, T.A. and Mein, R., 1996 Hydrological
Recipes: Estimation Techniques in Australian Hydrology. Cooperative Research Centre for Catch-
ment Hydrology, Australia, 125 pp.

Examples
# Distribution Free CUSUM for Turin 1961-2003
testTurin<- DistributionFreeCUSUM(yearly.average.temperature.Turin.Milan[,2])

# Distribution Free CUSUM for Milan 1961-2003


testMilan<- DistributionFreeCUSUM(yearly.average.temperature.Turin.Milan[,3])

ESDstatistic ESD statistic

Description
ESDstatistic returns the ESD statistic.

Usage
ESDstatistic(dataSeries)

Arguments
dataSeries time series of climate data

Value
The ESD statistic.

Author(s)
Jose Gama

Source
NIST/SEMATECH e-Handbook of Statistical Methods, 2013 http://www.itl.nist.gov/div898/
handbook/
FillDailyGapsWithSomeValue 17

References
NIST/SEMATECH e-Handbook of Statistical Methods, 2013 http://www.itl.nist.gov/div898/
handbook/

Examples
# ESD statistic for Turin 1961-2003
testTurin<- ESDstatistic(yearly.average.temperature.Turin.Milan[,2])

FillDailyGapsWithSomeValue
fill missing days with some value

Description
FillDailyGapsWithSomeValue fills (literally) missing days with date+some value.

Usage
FillDailyGapsWithSomeValue(dataYearSeries,FromDate,ToDate, missingValue=-9999)

Arguments
dataYearSeries dataframe with climate data
FromDate starting date
ToDate ending date
missingValue value representing missing data

Value
complete time series.

Author(s)
Jose Gama

Examples
# xgdcnCA008201000.dat is from ECA COLLEGEVILLE temperature
setwd(system.file('extdata/', package='climtrends'))
dailyCollegeville <- ReadGHCNymd('xgdcnCA008201000.dat')
daylyCollegeville2<-FillDailyGapsWithSomeValue(dailyCollegeville,
'1916-06-01','2010-11-30', missingValue=NA)
str(dailyCollegeville)
str(daylyCollegeville2)
18 FillYearlyGapsWithSomeValue

FillYearlyGapsWithSomeValue
fill missing days with some value

Description

FillYearlyGapsWithSomeValue fills (literally) missing years with date+some value.

Usage

FillYearlyGapsWithSomeValue(dataYearSeries,FromYear=min(dataYearSeries[,1]),
ToYear=max(dataYearSeries[,1]), missingValue=-9999)

Arguments

dataYearSeries dataframe with climate data


FromYear starting year
ToYear ending year
missingValue value representing missing data

Value

complete time series.

Author(s)

Jose Gama

Examples

# xgdcnCA008201000.dat is from ECA COLLEGEVILLE temperature


setwd(system.file('extdata/', package='climtrends'))
dailyCollegeville=ReadGHCNymd('xgdcnCA008201000.dat')
yearlyCollegeville=YearFuncFromDay(dailyCollegeville)
colnames(yearlyCollegeville) <- c('year','temperature')
yearlyCollegeville<-ValuesBetween2years(yearlyCollegeville,1918,1993)
yearlyCollegeville<-FillYearlyGapsWithSomeValue(yearlyCollegeville, missingValue=NA)
plot(yearlyCollegeville,type='l')
FindCommonPeriod 19

FindCommonPeriod Find the common period between several time series

Description
FindCommonPeriod returns the common period between several time series.

Usage
FindCommonPeriod(vFiles, returnMaxMin=FALSE)

Arguments
vFiles vector with file names of time series
returnMaxMin logical, TRUE=the function returns the max and min from all the series

Value
none or a vector (max, min).

Author(s)
Jose Gama

FindOutliersESDtest Find outliers based on the ESD test

Description
FindOutliersESDtest returns the position of the values outside the allowed range by a criteria
based on the ESD test.

Usage
FindOutliersESDtest(dataSeries,k=10,alpha=0.05)

Arguments
dataSeries time series of climate data
k number of outliers
alpha significance level

Value
Vector with the positions of the outliers.
20 FindOutliersGrubbsTwosided

Author(s)
Jose Gama

Source
NIST/SEMATECH e-Handbook of Statistical Methods, 2013 http://www.itl.nist.gov/div898/
handbook/

References
NIST/SEMATECH e-Handbook of Statistical Methods, 2013 http://www.itl.nist.gov/div898/
handbook/

Examples
y = c(-0.25, 0.68, 0.94, 1.15, 1.20, 1.26, 1.26,
1.34, 1.38, 1.43, 1.49, 1.49, 1.55, 1.56,
1.58, 1.65, 1.69, 1.70, 1.76, 1.77, 1.81,
1.91, 1.94, 1.96, 1.99, 2.06, 2.09, 2.10,
2.14, 2.15, 2.23, 2.24, 2.26, 2.35, 2.37,
2.40, 2.47, 2.54, 2.62, 2.64, 2.90, 2.92,
2.92, 2.93, 3.21, 3.26, 3.30, 3.59, 3.68,
4.30, 4.64, 5.34, 5.42, 6.01)
FindOutliersESDtest(y)

FindOutliersGrubbsTwosided
Find outliers based on the Grubbs test

Description
FindOutliersGrubbsTwosided returns the position of the values outside the allowed range by a
criteria based on the Grubbs test (two-sided, one-sided max and one-sided min).

Usage
FindOutliersGrubbsTwosided(dataSeries,alpha=0.05, iterative=TRUE)

Arguments
dataSeries time series of climate data
alpha significance level
iterative logical, TRUE=iterative, FALSE=first value only

Value
Vector with the positions of the outliers.
FindOutliersHampel 21

Author(s)
Jose Gama

Source
NIST/SEMATECH e-Handbook of Statistical Methods, 2013 http://www.itl.nist.gov/div898/
handbook/

References
NIST/SEMATECH e-Handbook of Statistical Methods, 2013 http://www.itl.nist.gov/div898/
handbook/

Examples
# Input data from the Tietjen and Moore paper.
y = c(199.31,199.53,200.19,200.82,201.92,201.95,202.18,245.57)
FindOutliersGrubbsTwosided(y, iterative=FALSE)
FindOutliersGrubbsTwosided(y)

FindOutliersHampel Find outliers based on quantiles

Description
FindOutliersHampel returns the position of the values outside the allowed range by the Hampel
method.

Usage
FindOutliersHampel(X, Y, DX=NA, Th=NA, hampelAdaptive=FALSE,Threshold=NA)

Arguments
X vector with data
Y vector with data, Gaussian distributed
DX half width of the filter window
Th threshold value used in the equation |Y - Y0| > T*S0
hampelAdaptive logical, TRUE=experimental adaptive Hampel filter
Threshold adaptive threshold

Value
Vector with the positions of the outliers.
22 FindOutliersMAD

Author(s)
Jose Gama

Source
Pearson RK, 2012 Mining Imperfect Data: Dealing with Contamination and Incomplete Records
urlhttp://exploringdatablog.blogspot.com/2012/01/moving-window-filters-and-pracma.html
Michael Lindholm Nielsen, 2012 urlhttp://www.mathworks.com/matlabcentral/fileexchange/34795-
outlier-detection-and-removal–hampel-

References
Pearson RK, 2012 Mining Imperfect Data: Dealing with Contamination and Incomplete Records
urlhttp://exploringdatablog.blogspot.com/2012/01/moving-window-filters-and-pracma.html
Michael Lindholm Nielsen, 2012 urlhttp://www.mathworks.com/matlabcentral/fileexchange/34795-
outlier-detection-and-removal–hampel-

Examples
X <- 1:1000 # Pseudo Time
Y <- 5000 + rnorm(1000) # Pseudo Data
Outliers <- sample(1:1000, 10, replace =FALSE) # Index of Outliers
Y[Outliers] <- Y[Outliers] + sample(1:1000, 10, replace =FALSE) # Pseudo Outliers
tmp <- FindOutliersHampel(X, Y)

FindOutliersMAD Find outliers based on the absolute deviation around the median

Description
FindOutliersMAD returns the position of the values outside the allowed range by a criteria based on
the the absolute deviation around the median (MAD), median-coef*MAD<x<median+coef*MAD.

Usage
FindOutliersMAD(dataSeries,coef=3)

Arguments
dataSeries time series of climate data
coef coefficient, 3=very conservative, 2.5=moderately conservative 2=poorly conser-
vative.

Value
Vector with the positions of the outliers.
FindOutliersQuant 23

Author(s)
Jose Gama

Source
Leys C, Ley C, Klein O, Bernard P, Licata L, 2013 Detecting outliers: Do not use standard deviation
around the mean, use absolute deviation around the median Journal of Experimental Social Psychol-
ogy volume 49, number 4 urlhttp://www.sciencedirect.com/science/article/pii/S0022103113000668

References
Leys C, Ley C, Klein O, Bernard P, Licata L, 2013 Detecting outliers: Do not use standard deviation
around the mean, use absolute deviation around the median Journal of Experimental Social Psychol-
ogy volume 49, number 4 urlhttp://www.sciencedirect.com/science/article/pii/S0022103113000668

Examples
y = c(1, 3, 3, 6, 8, 10, 10, 1000)
outlierMAD <- FindOutliersMAD(y)
y[outlierMAD]

FindOutliersQuant Find outliers based on quantiles

Description
FindOutliersQuant returns the position of the values outside the allowed range by a criteria based
on quantiles, q25-coef*(q75-q25)<x<q75+coef*(q75-q25).

Usage
FindOutliersQuant(dataSeries,coef=1.5)

Arguments
dataSeries time series of climate data
coef coefficient, 2=outliers, 3=extremes.

Value
Vector with the positions of the outliers.

Author(s)
Jose Gama
24 FindOutliersSD

Source
Stepanek, P. 2008 AnClim - software for time series analysis Dept. of Geography, Fac. of Natural
Sciences http://www.climahom.eu/AnClim.html

References
Stepanek, P. 2008 AnClim - software for time series analysis Dept. of Geography, Fac. of Natural
Sciences http://www.climahom.eu/AnClim.html

Examples
y = c(1, 3, 3, 6, 8, 10, 10, 1000)
FindOutliersQuant(y)

FindOutliersSD Find outliers based on quantiles

Description
FindOutliersSD returns the position of the values outside the allowed range by a criteria based on
the standard deviation, mean-coef*sd<x<mean+coef*sd based on the three-sigma rule.

Usage
FindOutliersSD(dataSeries,coef=3)

Arguments
dataSeries time series of climate data
coef coefficient, 1=68

Value
Vector with the positions of the outliers.

Author(s)
Jose Gama

Source
Leys C, Ley C, Klein O, Bernard P, Licata L, 2013 Detecting outliers: Do not use standard deviation
around the mean, use absolute deviation around the median Journal of Experimental Social Psychol-
ogy volume 49, number 4 urlhttp://www.sciencedirect.com/science/article/pii/S0022103113000668
FindOutliersTietjenMooreTest 25

References
Leys C, Ley C, Klein O, Bernard P, Licata L, 2013 Detecting outliers: Do not use standard deviation
around the mean, use absolute deviation around the median Journal of Experimental Social Psychol-
ogy volume 49, number 4 urlhttp://www.sciencedirect.com/science/article/pii/S0022103113000668

Examples
y = c(1, 3, 3, 6, 8, 10, 10, 1000)
FindOutliersSD(y,2)

FindOutliersTietjenMooreTest
Find outliers based on the Tietjen Moore test

Description
FindOutliersTietjenMooreTest returns the position of the values outside the allowed range by a
criteria based on the Tietjen Moore test.

Usage
FindOutliersTietjenMooreTest(dataSeries,k,alpha=0.05)

Arguments
dataSeries time series of climate data
k number of outliers
alpha significance level

Value
Vector with the positions of the outliers.

Author(s)
Jose Gama

Source
NIST/SEMATECH e-Handbook of Statistical Methods, 2013 http://www.itl.nist.gov/div898/
handbook/

References
NIST/SEMATECH e-Handbook of Statistical Methods, 2013 http://www.itl.nist.gov/div898/
handbook/
26 FindOutliersTrimmedMeans

Examples

x <- c(-1.40, -0.44, -0.30, -0.24, -0.22, -0.13, -0.05, 0.06, 0.10, 0.18,
0.20, 0.39, 0.48, 0.63, 1.01)
FindOutliersTietjenMooreTest(x, 2)

FindOutliersTrimmedMeans
Find outliers based on trimmed means

Description

FindOutliersTrimmedMeans returns the position of the values outside the allowed range by a
criteria based on trimmed means.

Usage

FindOutliersTrimmedMeans(dataSeries, percentTrim=0.1, coef=3)

Arguments

dataSeries time series of climate data


percentTrim percentage to trim
coef coefficient

Value

Vector with the positions of the outliers.

Author(s)

Jose Gama

Examples

FindOutliersTrimmedMeans(c(2, 4, 6, 7, 11, 21, 81, 90, 105, 121))


FindOutliersZscore 27

FindOutliersZscore Find outliers based on the z-score

Description
FindOutliersZscore returns the position of the values outside the allowed range by a criteria
based on the z-score, abs(Z)>coef. FindOutliersModifiedZscore uses the modified z-score.

Usage
FindOutliersZscore(dataSeries, coef=2.5)

Arguments
dataSeries time series of climate data
coef coefficient

Value
Vector with the positions of the outliers.

Author(s)
Jose Gama

Examples
FindOutliersZscore(c(2, 4, 6, 7, 11, 21, 81, 90, 105, 121))

FirstMonthOfSeason Get the first/last month of a season

Description
FirstMonthOfSeason returns the first month number for a given season 1 12, 2 3, 3 6, 4 9.
LastMonthOfSeason returns the last month number for a given season 1 2, 2 5, 3 8, 4 11.

Usage
FirstMonthOfSeason(intSeason)

Arguments
intSeason season
28 GetInfoHomogenization

Value
first/last month of a season.

Author(s)
Jose Gama

Examples
FirstMonthOfSeason(1) # Winter
FirstMonthOfSeason(2) # Spring
FirstMonthOfSeason(3) # Summer
FirstMonthOfSeason(4) # Fall

GetInfoHomogenization Useful info from an homogenization test

Description
GetInfoHomogenization calculates the SNHT or other method of homogenization and returns
useful info such as the year of change, To value, adjust value and more.

Usage
GetInfoHomogenization(dataYearSeries=NA,refYearSeries=NA,nYears=20,
diffFlag=TRUE,returnData=FALSE, homogenization=SNHTabsolute,
levelSignificance=c(99,95),criticalValues=climtrends::SNHT.Critical.Values)

Arguments
dataYearSeries dataframe with climate data
refYearSeries dataframe with climate data (reference)
nYears window of years to adjust
diffFlag logical TRUE=difference, FALSE=ratio
returnData logical TRUE=return the homogenization test data
homogenization homogenization test
levelSignificance
level of significance
criticalValues critical values for the homogenization test

Value
number of wet days.

Author(s)
Jose Gama
GetNDP 29

GetNDP Read data from a Numeric Data Package (NDP) file from GCMD

Description
GetNDP returns one climate variable from one NDP file read into a data.frame from NASA’s Global
Change Master Directory (GCMD) datasets.

Usage
GetNDP(ndpDat, climVar)

Arguments
ndpDat File name
climVar Cimate variable

Value
A data.frame with the read data.

Author(s)
Jose Gama

GetShiftValue Get peak value and its sign

Description
GetShiftValue returns the peak value and NegCurve returns the sign of the test values).

Usage
GetShiftValue(values)
NegCurve(values)

Arguments
values test values

Value
peak value or its sign.
30 IsLeapYear

Author(s)

Jose Gama

Examples

GetShiftValue(c(1,2,3,4,3,2,1))
NegCurve(c(1,2,3,4,3,2,1))

IsLeapYear Determine if a year is a leap year

Description

IsLeapYear returns TRUE for a leap year.

Usage

IsLeapYear(intYear)

Arguments

intYear year

Value

logical, TRUE = leap year.

Author(s)

Jose Gama

Examples

IsLeapYear(2010)
IsLeapYear(2011)
IsLeapYear(2012)
IsLeapYear(2013)
LastDayOfTheMonth 31

LastDayOfTheMonth Get the last day of a month

Description
LastDayOfTheMonth returns the last day of a month, considering leap years too.

Usage
LastDayOfTheMonth(intMonth,intYear)

Arguments
intMonth month 1-12
intYear year

Value
last day of a month.

Author(s)
Jose Gama

Examples
LastDayOfTheMonth(2,2010)
LastDayOfTheMonth(2,2011)
LastDayOfTheMonth(2,2012)
LastDayOfTheMonth(2,2013)

LevelSignifMarks Use symbols to represent the level of significance

Description
LevelSignifMarks returns a certain number of marks depending on the level of significance achieved
by the value statistic.

Usage
LevelSignifMarks(dataSeries=NA, levelSignificance=c(99,95), userDefSymbol='<')
32 ListContinuousDays

Arguments
dataSeries time series of climate data
levelSignificance
level of significance
userDefSymbol symbol used to represent the level of significance

Value
symbols representing the level of significance.

Author(s)
Jose Gama

ListContinuousDays List the days with continuous data

Description
ListContinuousDays lists the days with continuous data from a time series with daily data.

Usage
ListContinuousDays(dataSeries)

Arguments
dataSeries dataframe with climate data

Value
data.frame with the days with continuous data.

Author(s)
Jose Gama

Examples
# xgdcnCA008201000.dat is from ECA COLLEGEVILLE temperature
setwd(system.file('extdata/', package='climtrends'))
dailyCollegeville <- ReadGHCNymd('xgdcnCA008201000.dat')
ListContinuousDays(dailyCollegeville)
ListHomogStats 33

ListHomogStats List with the years of a probable shift and other info

Description
ListHomogStats applies an homogenization method and returns a list with the years of a probable
shift and other useful results. Equivalent to the "Homogenization Overview" in AnClim.

Usage
ListHomogStats(dataYearSeries=NA,refYearSeries=NA,diffFlag=TRUE,
homogenization=SNHTabsolute,levelSignificance=c(99,95),
criticalValues=climtrends::SNHT.Critical.Values,userDefSymbol='<',nYears=20)

Arguments
dataYearSeries dataframe with climate data
refYearSeries dataframe with climate data (reference)
diffFlag logical TRUE=difference, FALSE=ratio
homogenization homogenization test
levelSignificance
level of significance
criticalValues critical values for the homogenization test
userDefSymbol symbol used to represent the level of significance
nYears window of years to adjust

Value
none.

Author(s)
Jose Gama

Examples
# xgdcnCA008201000.dat is from ECA COLLEGEVILLE temperature
setwd(system.file('extdata/', package='climtrends'))
dailyCollegeville <- ReadGHCNymd('xgdcnCA008201000.dat')
ListHomogStats(dailyCollegeville)
34 ListHomogTZ

ListHomogTZ Useful info from an homogenization test

Description

ListHomogTZ calculates the SNHT or other method of homogenization and returns useful info on
the screen, such as the year of change, To value, adjust value and more.

Usage

ListHomogTZ(dataYearSeries=NA,refYearSeries=NA,diffFlag=TRUE,
homogenization=SNHTabsolute, testName='')

Arguments

dataYearSeries dataframe with climate data


refYearSeries dataframe with climate data (reference)
diffFlag logical TRUE=difference, FALSE=ratio
homogenization homogenization test
testName optional title for the report

Value

none.

Author(s)

Jose Gama

Examples

# xgdcnCA008201000.dat is from ECA COLLEGEVILLE temperature


setwd(system.file('extdata/', package='climtrends'))
dailyCollegeville <- ReadGHCNymd('xgdcnCA008201000.dat')
x <- ListHomogTZ(dailyCollegeville)
MedianCrossingTest 35

MedianCrossingTest Median Crossing (non-parametric test for randomness)

Description
MedianCrossingTest returns the result of the Median Crossing (non-parametric test for random-
ness) applied to a time series.

Usage
MedianCrossingTest(dataSeries)

Arguments
dataSeries vector with climate data

Value
The result of the Median Crossing test.

Author(s)
Jose Gama

Source
Chiew F. and Siriwardena L., 2005 CRC for Catchment Hydrology Trend 1.0.2 User Guide, chapter
4.2.11 Rank Difference Test, pp. 21 http://www.toolkit.net.au/Tools/TREND/documentation
Kundzewicz, Z.W. and Robson, A., 2000 Detecting Trend and Other Changes in Hydrological Data.
World Climate Program - Water, WMO/UNESCO, WCDMP-45, WMO/TD 1013, Geneva, 157 pp.
Grayson, R.B., Argent, R.M., Nathan, R.J., McMahon, T.A. and Mein, R., 1996 Hydrological
Recipes: Estimation Techniques in Australian Hydrology. Cooperative Research Centre for Catch-
ment Hydrology, Australia, 125 pp.

References
Chiew F. and Siriwardena L., 2005 CRC for Catchment Hydrology Trend 1.0.2 User Guide, chapter
4.2.11 Rank Difference Test, pp. 21 http://www.toolkit.net.au/Tools/TREND/documentation
Kundzewicz, Z.W. and Robson, A., 2000 Detecting Trend and Other Changes in Hydrological Data.
World Climate Program - Water, WMO/UNESCO, WCDMP-45, WMO/TD 1013, Geneva, 157 pp.
Grayson, R.B., Argent, R.M., Nathan, R.J., McMahon, T.A. and Mein, R., 1996 Hydrological
Recipes: Estimation Techniques in Australian Hydrology. Cooperative Research Centre for Catch-
ment Hydrology, Australia, 125 pp.
36 MonthlyAnomaliesFromDailyData

Examples
x=c(681,3661,8625,2475,573,2794,10190,5143,4139,8945,7295,19883,12119,8772,
8848,16309,16254,2303,7671,3985,
13742,5333,4859,12381,12137,6075,4669,378,7507,3891,13046,12954,2445,14759,
20200,16331,6922,6739,11629,
7351,2445,9960,10,11786,10214,11216,8393,10005,6896,11632)
R <- MedianCrossingTest(x)
plot(1941:1989,R,type='b',pch=15)

MonthlyAnomaliesFromDailyData
Monthly anomalies

Description
MonthlyAnomaliesFromDailyData returns the monthly anomalies (observed values minus clima-
tology) for a certain year.

Usage
MonthlyAnomaliesFromDailyData(dataSeries, yearAnomalies = NA, fromYear=1961,
toYear=1990)

Arguments
dataSeries time series of climate data
yearAnomalies year of observed values
fromYear start of the long-term average for the climatology
toYear end of the long-term average for the climatology

Value
Monthly anomalies.

Author(s)
Jose Gama

Examples
# xgdcnCA008201000.dat is from ECA COLLEGEVILLE temperature
setwd(system.file('extdata/', package='climtrends'))
dailyCollegeville <- ReadGHCNymd('xgdcnCA008201000.dat')
MonthlyAnomaliesFromDailyData(dailyCollegeville, 1960)
MonthlyClimatologyFromDailyData 37

MonthlyClimatologyFromDailyData
Monthly climatology

Description
MonthlyClimatologyFromDailyData returns the monthly climatology (long-term average, for each
month, of a given variable).

Usage
MonthlyClimatologyFromDailyData(dataSeries,fromYear=1961,toYear=1990)

Arguments
dataSeries time series of climate data
fromYear start of the long-term average
toYear end of the long-term average

Value
Monthly climatology.

Author(s)
Jose Gama

Examples
# xgdcnCA008201000.dat is from ECA COLLEGEVILLE temperature
setwd(system.file('extdata/', package='climtrends'))
dailyCollegeville <- ReadGHCNymd('xgdcnCA008201000.dat')
MonthlyClimatologyFromDailyData(dailyCollegeville)

MonthlyFuncFromDay Monthly values converted from daily values

Description
MonthlyFuncFromDay returns monthly values converted by a function from daily values.

Usage
MonthlyFuncFromDay(yearDF, datecol=1,valcol=2, mfunc=mean)
38 MonthTrendYearsFuncFromDay

Arguments
yearDF dataframe with climate data
datecol column with dates
valcol column with values
mfunc function to apply on the data

Value
Monthly values.

Author(s)
Jose Gama

Examples
# xgdcnCA008201000.dat is from ECA COLLEGEVILLE temperature
setwd(system.file('extdata/', package='climtrends'))
dailyCollegeville <- ReadGHCNymd('xgdcnCA008201000.dat')
MonthlyMeanCollegeville <- MonthlyFuncFromDay(dailyCollegeville)

MonthTrendYearsFuncFromDay
Monthly values converted from daily values

Description
MonthTrendYearsFuncFromDay returns monthly values converted by a function from daily values.

Usage
MonthTrendYearsFuncFromDay(yearDF, datecol=1,valcol=2, mfunc=mean, mmonth)

Arguments
yearDF dataframe with climate data
datecol column with dates
valcol column with values
mfunc function to apply on the data
mmonth starting month

Value
Monthly values.
peaksP 39

Author(s)
Jose Gama

Examples
# xgdcnCA008201000.dat is from ECA COLLEGEVILLE temperature
setwd(system.file('extdata/', package='climtrends'))
dailyCollegeville <- ReadGHCNymd('xgdcnCA008201000.dat')
MonthlyCollegeville <- MonthTrendYearsFuncFromDay(dailyCollegeville, mmonth=1)
MonthlyCollegeville[,1] <- as.Date(MonthlyCollegeville[,1], origin = "1970-01-01")

peaksP Use symbols to represent the level of significance

Description
peaksP returns a certain number of marks depending on the level of significance achieved by the
value statistic.

Usage
peaksP(dataSeries,span=3)

Arguments
dataSeries time series of climate data
span span, odd number

Value
symbols representing the level of significance.

Author(s)
Jose Gama

Source
R equivalent of Splus peaks() function

References
R equivalent of Splus peaks() function

Examples
peaksP(c(1,2,3,4,3,2,1))
40 PettittTest

Pettitt.Critical.Values
Critical values for the Pettitt test

Description
Pettitt.Critical.Values contains the critical values for the Pettitt test.

Usage
Pettitt.Critical.Values

Format
This data frame contains 2 columns (95 and 6 rows (n=10, 20, 30, 40, 50, 100) of data.

Author(s)
Jose Gama

Source
Buishand TA., 1981 The analysis of homogeneity of long-term rainfall records in the Netherlands.
KNMI Scientific Report WR 81-7, De Bilt, The Netherlands.

References
Buishand TA., 1981 The analysis of homogeneity of long-term rainfall records in the Netherlands.
KNMI Scientific Report WR 81-7, De Bilt, The Netherlands.

Examples
data(Pettitt.Critical.Values)
Pettitt.Critical.Values

PettittTest Pettitt test

Description
PettittTest returns the result of the Pettitt test applied to a time series.

Usage
PettittTest(dataSeries)
PlotHomog 41

Arguments

dataSeries time series of climate data

Value

The result of the Pettitt test.

Author(s)

Jose Gama

Source

Wijngaard, J. B., Klein Tank, A. M. G. and Können, G. P. (2003), Homogeneity of 20th cen-
tury European daily temperature and precipitation series. Int. J. Climatol., 23: 679–692. doi:
10.1002/joc.906

References

Wijngaard, J. B., Klein Tank, A. M. G. and Können, G. P. (2003), Homogeneity of 20th cen-
tury European daily temperature and precipitation series. Int. J. Climatol., 23: 679–692. doi:
10.1002/joc.906

Examples
# Pettitt range test for Turin 1961-2003
PettittTurin<- PettittTest(yearly.average.temperature.Turin.Milan[,2])

# Pettitt range test for Milan 1961-2003


PettittMilan<- PettittTest(yearly.average.temperature.Turin.Milan[,3])

plot(1961:2003,PettittTurin,type='l',col='cyan',ylim=c(-400,0),
main='Pettitt range test 1961-2003',xlab='Years',ylab='Pettitt value')
par(new=TRUE)
plot(1961:2003,PettittMilan,type='l',col='magenta',ylim=c(-400,0),xlab='',ylab='')
legend("top",c('Turin','Milan'),text.col=c('cyan','magenta'))

PlotHomog Plot the graphics for many homogenization methods

Description

PlotHomog plot the graphics for many homogenization methods with an indication of the peak and
significance levels.
42 PlotSeriesAndRefSimple

Usage
PlotHomog(dataYearSeries=NA,refYearSeries=NA,diffFlag=TRUE,
homogenization=SNHTabsolute,levelSignificance=c(99,95),
criticalValues=climtrends::SNHT.Critical.Values,posLegend="topright",rowbycol=NULL)

Arguments
dataYearSeries dataframe with climate data
refYearSeries dataframe with climate data (reference)
diffFlag logical TRUE=difference, FALSE=ratio
homogenization homogenization test
levelSignificance
level of significance
criticalValues critical values for the homogenization test
posLegend position of the legend
rowbycol vector with (rows, columns)

Value
none.

Author(s)
Jose Gama

Examples
# xgdcnCA008201000.dat is from ECA COLLEGEVILLE temperature
setwd(system.file('extdata/', package='climtrends'))
dailyCollegeville <- ReadGHCNymd('xgdcnCA008201000.dat')
yearlyCollegeville=YearFuncFromDay(dailyCollegeville)
colnames(yearlyCollegeville) <- c('year','temperature')
PlotHomog(yearlyCollegeville)

PlotSeriesAndRefSimple
Plot a series and one or more reference series

Description
PlotSeriesAndRefSimple plot a series and one or more reference series. Similar to Anclim’s
"Analyzing Plot Series".
PlotSeriesDifference 43

Usage
PlotSeriesAndRefSimple(dataYearSeries=NA,refYearSeries=NA)

Arguments
dataYearSeries dataframe with climate data
refYearSeries dataframe with climate data (reference)

Value
none.

Author(s)
Jose Gama

Examples
setwd(system.file('extdata/', package='climtrends'))
fm1<-read.delim('c_Casl_3.txt',sep='',header=FALSE)
fmRef <- read.delim('c_casl_O_3_REF.TXT',sep='',header=FALSE)
PlotSeriesAndRefSimple(fm1[,c(1,12)],fmRef[,c(1,12)])

PlotSeriesDifference Plot the difference between 2 series

Description
PlotSeriesDifference plot the difference between 2 series (series - reference series). Similar to
Anclim’s "Plot of Differences".

Usage
PlotSeriesDifference(dataYearSeries=NA,refYearSeries=NA, diffFlag=TRUE)

Arguments
dataYearSeries dataframe with climate data
refYearSeries dataframe with climate data (reference)
diffFlag logical TRUE=difference, FALSE=ratio

Value
none.

Author(s)
Jose Gama
44 Rank.Von.Neumann.Ratio.Test.Critical.Values

Examples
setwd(system.file('extdata/', package='climtrends'))
fm1<-read.delim('c_Casl_3.txt',sep='',header=FALSE)
fmRef <- read.delim('c_casl_O_3_REF.TXT',sep='',header=FALSE)
PlotSeriesDifference(fm1[,c(1,12)],fmRef[,c(1,12)])

Rank.Von.Neumann.Ratio.Test.Critical.Values
Critical values for the Rank Von-Neumann Ratio Test

Description
Rank.Von.Neumann.Ratio.Test.Critical.Values contains the critical values for the Rank Von-
Neumann Ratio Test.

Usage
Rank.Von.Neumann.Ratio.Test.Critical.Values

Format
This data frame contains 6 columns (Q90 and 7 rows (n=10, 20, 30, 40, 50, 100 and Inf) of data.

Author(s)
Jose Gama

Source
Robert Bartels, 1982 The Rank Version of von Neumann’s Ratio Test for Randomness Journal of the
American Statistical Association Vol. 77, No. 377 pp. 40-46 http://www.jstor.org/stable/
2287767

References
Robert Bartels, 1982 The Rank Version of von Neumann’s Ratio Test for Randomness Journal of the
American Statistical Association Vol. 77, No. 377 pp. 40-46 http://www.jstor.org/stable/
2287767

Examples
data(Rank.Von.Neumann.Ratio.Test.Critical.Values)
Rank.Von.Neumann.Ratio.Test.Critical.Values
RankDifferenceTest 45

RankDifferenceTest Rank Difference test (non-parametric test for randomness)

Description
RankDifferenceTest returns the result of the Rank Difference test (non-parametric test for ran-
domness) applied to a time series.

Usage
RankDifferenceTest(dataSeries)

Arguments
dataSeries vector with climate data

Value
The result of the Rank Difference test.

Author(s)
Jose Gama

Source
Chiew F. and Siriwardena L., 2005 CRC for Catchment Hydrology Trend 1.0.2 User Guide, chapter
4.2.11 Rank Difference Test, pp. 21 http://www.toolkit.net.au/Tools/TREND/documentation
Kundzewicz, Z.W. and Robson, A., 2000 Detecting Trend and Other Changes in Hydrological Data.
World Climate Program - Water, WMO/UNESCO, WCDMP-45, WMO/TD 1013, Geneva, 157 pp.
Grayson, R.B., Argent, R.M., Nathan, R.J., McMahon, T.A. and Mein, R., 1996 Hydrological
Recipes: Estimation Techniques in Australian Hydrology. Cooperative Research Centre for Catch-
ment Hydrology, Australia, 125 pp.

References
Chiew F. and Siriwardena L., 2005 CRC for Catchment Hydrology Trend 1.0.2 User Guide, chapter
4.2.11 Rank Difference Test, pp. 21 http://www.toolkit.net.au/Tools/TREND/documentation
Kundzewicz, Z.W. and Robson, A., 2000 Detecting Trend and Other Changes in Hydrological Data.
World Climate Program - Water, WMO/UNESCO, WCDMP-45, WMO/TD 1013, Geneva, 157 pp.
Grayson, R.B., Argent, R.M., Nathan, R.J., McMahon, T.A. and Mein, R., 1996 Hydrological
Recipes: Estimation Techniques in Australian Hydrology. Cooperative Research Centre for Catch-
ment Hydrology, Australia, 125 pp.
46 RankSumTest

Examples
x=c(681,3661,8625,2475,573,2794,10190,5143,4139,8945,7295,19883,12119,8772,
8848,16309,16254,2303,7671,3985,
13742,5333,4859,12381,12137,6075,4669,378,7507,3891,13046,12954,2445,14759,
20200,16331,6922,6739,11629,
7351,2445,9960,10,11786,10214,11216,8393,10005,6896,11632)
RankDifferenceTest(x)

RankSumTest Rank Sum test

Description

RankSumTest returns the result of the Rank Sum test (non-parametric test for difference in median
from two data periods) applied to a time series.

Usage

RankSumTest(dataSeries, period1)

Arguments

dataSeries time series of climate data


period1 first period

Value

The result of the Rank Sum test.

Author(s)

Jose Gama

Source

Chiew F. and Siriwardena L., 2005 CRC for Catchment Hydrology Trend 1.0.2 User Guide, chapter
4.2.11 Rank Difference Test, pp. 21 http://www.toolkit.net.au/Tools/TREND/documentation
Kundzewicz, Z.W. and Robson, A., 2000 Detecting Trend and Other Changes in Hydrological Data.
World Climate Program - Water, WMO/UNESCO, WCDMP-45, WMO/TD 1013, Geneva, 157 pp.
Grayson, R.B., Argent, R.M., Nathan, R.J., McMahon, T.A. and Mein, R., 1996 Hydrological
Recipes: Estimation Techniques in Australian Hydrology. Cooperative Research Centre for Catch-
ment Hydrology, Australia, 125 pp.
ReadClimexpKnmiNL 47

References

Chiew F. and Siriwardena L., 2005 CRC for Catchment Hydrology Trend 1.0.2 User Guide, chapter
4.2.11 Rank Difference Test, pp. 21 http://www.toolkit.net.au/Tools/TREND/documentation
Kundzewicz, Z.W. and Robson, A., 2000 Detecting Trend and Other Changes in Hydrological Data.
World Climate Program - Water, WMO/UNESCO, WCDMP-45, WMO/TD 1013, Geneva, 157 pp.
Grayson, R.B., Argent, R.M., Nathan, R.J., McMahon, T.A. and Mein, R., 1996 Hydrological
Recipes: Estimation Techniques in Australian Hydrology. Cooperative Research Centre for Catch-
ment Hydrology, Australia, 125 pp.

Examples
x=c(681,3661,8625,2475,573,2794,10190,5143,4139,8945,7295,19883,12119,8772,
8848,16309,16254,2303,7671,3985,
13742,5333,4859,12381,12137,6075,4669,378,7507,3891,13046,12954,2445,14759,
20200,16331,6922,6739,11629,
7351,2445,9960,10,11786,10214,11216,8393,10005,6896,11632)
RankSumTest(x, 20)

ReadClimexpKnmiNL Read KNMI Climate Explorer files

Description

ReadClimexpKnmiNL reads KNMI Climate Explorer files.

Usage

ReadClimexpKnmiNL(filename)

Arguments

filename File name

Value

A dataframe with the read data.

Author(s)

Jose Gama
48 ReadCRDEC

ReadClimexpKnmiNL12month
Read monthly values KNMI Climate Explorer files

Description
ReadClimexpKnmiNL12month reads a monthly values file in climexp.knmi.nl format.

Usage
ReadClimexpKnmiNL12month(filename)

Arguments
filename File name

Value
A dataframe with the read data.

Author(s)
Jose Gama

ReadCRDEC Read GHCN-D files

Description
ReadCRDEC reads a file from GHCN-D Canada, with date+Q into a dataframe.

Usage
ReadCRDEC(filename, FlagAnnualMean = F)

Arguments
filename File name
FlagAnnualMean Logical, if TRUE then return the annual mean instead of the monthly values

Value
A dataframe with the read data.

Author(s)
Jose Gama
ReadECAdata 49

ReadECAdata Read data from a ECA data file

Description
ReadECAdata reads data from a file downloaded from the European Climate Assessment & Dataset
project.

Usage
ReadECAdata(filename)

Arguments
filename File name

Value
A matrix with the read data.

Author(s)
Jose Gama

ReadEtmgegFile Read USHCN files

Description
ReadEtmgegFile reads a file from the Royal Netherlands Meteorological Institute (KNMI) into a
dataframe.

Usage
ReadEtmgegFile(filename, optCols = NULL)

Arguments
filename File name
optCols user select colums

Value
A dataframe with the read data.
50 ReadGHCNymd

Author(s)

Jose Gama

Examples

# data from the ECA station series of Eelde (The Netherlands) from 1900 to 2000
EtmgegData<-ReadEtmgegFile('etmgeg_280.txt',c(2,12,13,15))

ReadGHCNymd Read GHCN-Daily files

Description

ReadGHCNymd reads Global Historical Climatology Network-Daily (GHCN-Daily) files.

Usage

ReadGHCNymd(filename)

Arguments

filename File name

Value

A dataframe with the read data.

Author(s)

Jose Gama

Examples

# xgdcnCA008201000.dat is from ECA COLLEGEVILLE temperature


setwd(system.file('extdata/', package='climtrends'))
dailyCollegeville=ReadGHCNymd('xgdcnCA008201000.dat')
ReadHERTTAdailyCSV 51

ReadHERTTAdailyCSV Read HERTTA files

Description
ReadHERTTAdailyCSV reads a file from Finland’s Environmental centre (HERTTA) into a dataframe.

Usage
ReadHERTTAdailyCSV(filename)

Arguments
filename File name

Value
A dataframe with the read data.

Author(s)
Jose Gama

ReadHERTTAdmyQdaily Read HERTTA month+year+Q files

Description
ReadHERTTAdmyQdaily reads a month+year+Q file from Finland’s Environmental centre (HERTTA)
into a dataframe.

Usage
ReadHERTTAdmyQdaily(filename)

Arguments
filename File name

Value
A dataframe with the read data.

Author(s)
Jose Gama
52 ReadNdp040stationDat

ReadMeteoSwiss Read MeteoSwiss files

Description
ReadMeteoSwiss reads a daily values file from MeteoSwiss.

Usage
ReadMeteoSwiss(filename)

Arguments
filename File name

Value
A dataframe with the read data.

Author(s)
Jose Gama

ReadNdp040stationDat Read data from a CDIAC data file

Description
ReadNdp040stationDat reads data from a file downloaded from the Carbon Dioxide Information
Analysis Center (CDIAC). Daily Temperature and Precipitation Data for 223 Former-USSR Sta-
tions.

Usage
ReadNdp040stationDat(filename)

Arguments
filename File name

Value
A matrix with the read data.

Author(s)
Jose Gama
ReadPSMSLmonthly 53

ReadPSMSLmonthly Read PSMSL files

Description
ReadPSMSLmonthly reads a file from the Permanent Service for Mean Sea Level (PSMSL) into a
dataframe.

Usage
ReadPSMSLmonthly(filename)

Arguments
filename File name

Value
A dataframe with the read data.

Author(s)
Jose Gama

ReadUSGS2timeseries Read a a USGS discharge file

Description
ReadUSGS2timeseries reads a .part file which is a USGS discharge file.

Usage
ReadUSGS2timeseries(filename)

Arguments
filename File name

Value
A matrix with the read data.

Author(s)
Jose Gama
54 ReadYearAnd12MonthsData

ReadUSHCN Read USHCN files

Description
ReadUSHCN reads a file from the United States Historical Climatology Network (USHCN) into a
dataframe.

Usage
ReadUSHCN(filename)

Arguments
filename File name

Value
A dataframe with the read data.

Author(s)
Jose Gama

ReadYearAnd12MonthsData
Read a TAB delimited data file with year and months in columns

Description
ReadYearAnd12MonthsData reads a monthly values file with the data as y + 12 months in 1 line.

Usage
ReadYearAnd12MonthsData(filename)

Arguments
filename File name

Value
A matrix with the read data.

Author(s)
Jose Gama
SiegelTukey 55

SiegelTukey annual mean of the absolute day-to-day differences of DTR (Siegel-


Tukey)

Description
SiegelTukey returns the annual mean of the absolute day-to-day differences of the diurnal temper-
ature range (SiegelTukey).

Usage
SiegelTukey(x,y,id.col=FALSE,adjust.median=FALSE,rnd=-1,alternative="two.sided",
mu=0 ,paired=FALSE,exact=FALSE,correct=TRUE,conf.int=FALSE,conf.level=0.95,
showresult=TRUE, returnresult=TRUE)

Arguments
x vector of data
y Data of the second group (if id.col=FALSE) or group indicator (if id.col=TRUE).
In the latter case, y MUST take 1 or 2 to indicate observations of group 1 and 2,
respectively, and x must contain the data for both groups.
id.col If FALSE (default), then x and y are the data columns for group 1 and 2, respec-
tively. If TRUE, the y is the group indicator.
adjust.median Should between-group differences in medians be leveled before performing the
test? In certain cases, the Siegel-Tukey test is susceptible to median differences
and may indicate significant differences in variability that, in reality, stem from
differences in medians.
rnd Should the data be rounded and, if so, to which decimal? The default (-1) uses
the data as is. Otherwise, rnd must be a non-negative integer. Typically, this
option is not needed. However, occasionally, differences in the precision with
which certain functions return values cause the merging of two data frames to
fail within the SiegelTukey function. Only then rounding is necessary. This
operation should not be performed if it affects the ranks of observations.
alternative "one.sided" or "two.sided".
mu mu.
paired Logical, TRUE=paired, FALSE=not paired.
exact Logical, TRUE=paired, FALSE=.
correct Logical, TRUE=paired, FALSE=.
conf.int Confidence interval.
conf.level Confidence level.
showresult Logical, show the result or not.
returnresult Logical, return the result or not.
56 SiegelTukey

Value
groupmedian1 Group median 1
groupmedian2 Group median 2
testmediandifferences
Wilcoxon-test for between-group differences in median (after the median ad-
justment if specified)
wilcox.test.p.value
Wilcoxon-test for between-group differences in median (after the median ad-
justment if specified)
wilcox.test.null.value
Wilcoxon-test for between-group differences in median (after the median ad-
justment if specified)
unique.x.tieadjusted.rank
Unique values of x and their tie-adjusted Siegel-Tukey ranks
tieadjusted.ranks.group1
Tie-adjusted Siegel-Tukey ranks of group 1
tieadjusted.ranks.group2
Tie-adjusted Siegel-Tukey ranks of group 2
wilcoxon.W Wilcoxon-test for between-group differences in median (after the median ad-
justment if specified)
wilcoxon.p.value
Wilcoxon-test for between-group differences in median (after the median ad-
justment if specified)

Author(s)
Daniel Malter

Source
Daniel Malter, 2012 https://stat.ethz.ch/pipermail/r-help/2010-February/229215.html

References
Sidney Siegel and John Wilder Tukey, 1960 A nonparametric sum of ranks procedure for relative
spread in unpaired samples. Journal of the American Statistical Association.
David J. Sheskin, 2004 Handbook of parametric and nonparametric statistical procedures. 3rd
edition. Chapman and Hall/CRC. Boca Raton, FL.
Richard H. McCuen, 2002 Modeling Hydrologic Change: Statistical Methods CRC Press

Examples
x=c(4,4,5,5,6,6)
y=c(0,0,1,9,10,10)
SiegelTukey(x,y)
SNHT.Critical.Values 57

SNHT.Critical.Values Critical values for the Pettitt test

Description

SNHT.Critical.Values contains the critical values for the SNHT test from Khaliq and Ouarda,
2007. SNHT.Critical.Values.Alexandersson1997 has the data from Alexandersson 1997, which
is used in AnClim.

Usage

SNHT.Critical.Values

Format

This data frame contains 2 columns (90.00 and 108 rows (n=10, 12, 14, 16, ..., 15000, 20000,
50000) of data.

Author(s)

Jose Gama

Source

Khaliq, M. N., Ouarda, T. B. M. J. 2007 On the critical values of the standard normal homogeneity
test (SNHT) International Journal of Climatology John Wiley & Sons, Ltd. http://dx.doi.org/
10.1002/joc.1438

References

Khaliq, M. N., Ouarda, T. B. M. J. 2007 On the critical values of the standard normal homogeneity
test (SNHT) International Journal of Climatology John Wiley & Sons, Ltd. http://dx.doi.org/
10.1002/joc.1438

Examples

data(SNHT.Critical.Values)
SNHT.Critical.Values
58 SNHT.TwoDifferentSDs.Critical.Values

SNHT.TwoDifferentSDs.Critical.Values
Critical values for the standard normal homogeneity test (SNHT) for
two different SDs

Description
SNHT.TwoDifferentSDs.Critical.Values contains the critical values for the SNHT test for 2
different SDs from Alexandersson and Moberg (1997).

Usage
SNHT.TwoDifferentSDs.Critical.Values

Format
This data frame contains 2 columns (90.00 and 108 rows (n=10, 12, 14, 16, ..., 15000, 20000,
50000) of data.

Author(s)
Jose Gama

Source
ALEXANDERSSON, H. and MOBERG, A. (1997), HOMOGENIZATION OF SWEDISH TEM-
PERATURE DATA. PART I: HOMOGENEITY TEST FOR LINEAR TRENDS. Int. J. Climatol.,
17: 25–34. doi: 10.1002/(SICI)1097-0088(199701)17:1<25::AID-JOC103>3.0.CO;2-J
Tuomenvirta, H., 2002: Homogeneity testing and adjustment of climatic time series in Finland.
Geophysica, 38(1-2), 15-41.

References
ALEXANDERSSON, H. and MOBERG, A. (1997), HOMOGENIZATION OF SWEDISH TEM-
PERATURE DATA. PART I: HOMOGENEITY TEST FOR LINEAR TRENDS. Int. J. Climatol.,
17: 25–34. doi: 10.1002/(SICI)1097-0088(199701)17:1<25::AID-JOC103>3.0.CO;2-J
Tuomenvirta, H., 2002: Homogeneity testing and adjustment of climatic time series in Finland.
Geophysica, 38(1-2), 15-41.

Examples
data(SNHT.TwoDifferentSDs.Critical.Values)
SNHT.TwoDifferentSDs.Critical.Values
SNHT.TwoShifts.Critical.Values 59

SNHT.TwoShifts.Critical.Values
Critical values for the standard normal homogeneity test (SNHT) for
two shifts

Description

SNHT.TwoShifts.Critical.Values contains the critical values for the SNHT test for 2 shifts from
Alexandersson (1995).

Usage

SNHT.TwoShifts.Critical.Values

Format

This data frame contains 2 columns (90.00 and 108 rows (n=10, 12, 14, 16, ..., 15000, 20000,
50000) of data.

Author(s)

Jose Gama

Source

Alexandersson, H., 1995. Homogeneity testing, multiple breaks and trends. Proceedings of the
Sixth International Meeting on Statistical Climatology, Galway, Ireland, 439-441.
Tuomenvirta, H., 2002: Homogeneity testing and adjustment of climatic time series in Finland.
Geophysica, 38(1-2), 15-41.

References

Alexandersson, H., 1995. Homogeneity testing, multiple breaks and trends. Proceedings of the
Sixth International Meeting on Statistical Climatology, Galway, Ireland, 439-441.
Tuomenvirta, H., 2002: Homogeneity testing and adjustment of climatic time series in Finland.
Geophysica, 38(1-2), 15-41.

Examples
data(SNHT.TwoShifts.Critical.Values)
SNHT.TwoShifts.Critical.Values
60 SNHTabsolute

SNHTabsolute standard normal homogeneity test (SNHT) absolute homogeneity test

Description
SNHTabsolute returns the result of the standard normal homogeneity test (SNHT) absolute homo-
geneity test applied to a time series.

Usage
SNHTabsolute(dataSeries)

Arguments
dataSeries time series of climate data

Value
The result of the SNHT absolute homogeneity test.

Author(s)
Jose Gama

Source
Wijngaard, J. B., Klein Tank, A. M. G. and Können, G. P. (2003), Homogeneity of 20th cen-
tury European daily temperature and precipitation series. Int. J. Climatol., 23: 679–692. doi:
10.1002/joc.906

References
Wijngaard, J. B., Klein Tank, A. M. G. and Können, G. P. (2003), Homogeneity of 20th cen-
tury European daily temperature and precipitation series. Int. J. Climatol., 23: 679–692. doi:
10.1002/joc.906

Examples
# standard normal homogeneity test (SNHT) for Turin 1961-2003
testTurin<- SNHTabsolute(yearly.average.temperature.Turin.Milan[,2])

# standard normal homogeneity test (SNHT) for Milan 1961-2003


testMilan<- SNHTabsolute(yearly.average.temperature.Turin.Milan[,3])

plot(1961:2002,testTurin,type='l',col='cyan',ylim=c(0,20),
main='standard normal homogeneity test (SNHT) 1961-2003',xlab='Years',ylab='test value')
par(new=TRUE)
plot(1961:2002,testMilan,type='l',col='magenta',ylim=c(0,20),xlab='',ylab='')
legend("top",c('Turin','Milan'),text.col=c('cyan','magenta'))
SNHTabsolute2SDs 61

SNHTabsolute2SDs standard normal homogeneity test (SNHT) absolute homogeneity test


for two different SDs

Description

SNHTabsolute2SDs returns the result of the standard normal homogeneity test (SNHT) absolute
homogeneity test for two different SDs applied to a time series.

Usage

SNHTabsolute2SDs(dataSeries)

Arguments

dataSeries time series of climate data

Value

The result of the SNHT absolute homogeneity test for two different SDs.

Author(s)

Jose Gama

Source

ALEXANDERSSON, H. and MOBERG, A. (1997), HOMOGENIZATION OF SWEDISH TEM-


PERATURE DATA. PART I: HOMOGENEITY TEST FOR LINEAR TRENDS. Int. J. Climatol.,
17: 25–34. doi: 10.1002/(SICI)1097-0088(199701)17:1<25::AID-JOC103>3.0.CO;2-J
Tuomenvirta, H., 2002: Homogeneity testing and adjustment of climatic time series in Finland.
Geophysica, 38(1-2), 15-41.

References

ALEXANDERSSON, H. and MOBERG, A. (1997), HOMOGENIZATION OF SWEDISH TEM-


PERATURE DATA. PART I: HOMOGENEITY TEST FOR LINEAR TRENDS. Int. J. Climatol.,
17: 25–34. doi: 10.1002/(SICI)1097-0088(199701)17:1<25::AID-JOC103>3.0.CO;2-J
Tuomenvirta, H., 2002: Homogeneity testing and adjustment of climatic time series in Finland.
Geophysica, 38(1-2), 15-41.
62 SNHTabsoluteDoubleShift

Examples
# standard normal homogeneity test (SNHT) for Turin 1961-2003
testTurin<- SNHTabsolute2SDs(yearly.average.temperature.Turin.Milan[,2])

# standard normal homogeneity test (SNHT) for Milan 1961-2003


testMilan<- SNHTabsolute2SDs(yearly.average.temperature.Turin.Milan[,3])

plot(1961:2000,testTurin,type='l',col='cyan',ylim=c(0,30),
main='standard normal homogeneity test (SNHT) 2 SDs 1961-2003',xlab='Years',ylab='test value')
par(new=TRUE)
plot(1961:2000,testMilan,type='l',col='magenta',ylim=c(0,30),xlab='',ylab='')
legend("top",c('Turin','Milan'),text.col=c('cyan','magenta'))

SNHTabsoluteDoubleShift
standard normal homogeneity test (SNHT) absolute homogeneity test
for two shifts

Description
SNHTabsoluteDoubleShift returns the result of the standard normal homogeneity test (SNHT)
absolute homogeneity test for two shifts applied to a time series.

Usage
SNHTabsoluteDoubleShift(dataSeries)

Arguments
dataSeries time series of climate data

Value
SNHTdata T SNHT absolute homogeneity test for trends
PosSecondShift estimated position of the second shift

Author(s)
Jose Gama

Source
ALEXANDERSSON, H. and MOBERG, A. (1997), HOMOGENIZATION OF SWEDISH TEM-
PERATURE DATA. PART I: HOMOGENEITY TEST FOR LINEAR TRENDS. Int. J. Climatol.,
17: 25–34. doi: 10.1002/(SICI)1097-0088(199701)17:1<25::AID-JOC103>3.0.CO;2-J
Tuomenvirta, H., 2002: Homogeneity testing and adjustment of climatic time series in Finland.
Geophysica, 38(1-2), 15-41.
SNHTabsoluteII 63

References
ALEXANDERSSON, H. and MOBERG, A. (1997), HOMOGENIZATION OF SWEDISH TEM-
PERATURE DATA. PART I: HOMOGENEITY TEST FOR LINEAR TRENDS. Int. J. Climatol.,
17: 25–34. doi: 10.1002/(SICI)1097-0088(199701)17:1<25::AID-JOC103>3.0.CO;2-J
Tuomenvirta, H., 2002: Homogeneity testing and adjustment of climatic time series in Finland.
Geophysica, 38(1-2), 15-41.

Examples
# standard normal homogeneity test for two shifts(SNHT) for Turin 1961-2003
testTurin<- SNHTabsoluteDoubleShift(yearly.average.temperature.Turin.Milan[,2])$SNHTdata

# standard normal homogeneity test for two shifts(SNHT) for Milan 1961-2003
testMilan<- SNHTabsoluteDoubleShift(yearly.average.temperature.Turin.Milan[,3])$SNHTdata

plot(1961:2002,testTurin,type='l',col='cyan',ylim=c(0,30),
main='standard normal homogeneity test (SNHT) for two shifts 1961-2003',
xlab='Years',ylab='test value')
par(new=TRUE)
plot(1961:2002,testMilan,type='l',col='magenta',ylim=c(0,30),xlab='',ylab='')
legend("top",c('Turin','Milan'),text.col=c('cyan','magenta'))

SNHTabsoluteII standard normal homogeneity test (SNHT) absolute homogeneity test,


SD different from 1

Description
SNHTabsoluteII returns the result of the standard normal homogeneity test (SNHT) absolute ho-
mogeneity test with standard deviation different from 1, applied to a time series.

Usage
SNHTabsoluteII(dataSeries)

Arguments
dataSeries time series of climate data

Value
The result of the SNHT absolute homogeneity test with SD != 1.

Author(s)
Jose Gama
64 SNHTabsoluteTrend

Source
Wijngaard, J. B., Klein Tank, A. M. G. and Können, G. P. (2003), Homogeneity of 20th cen-
tury European daily temperature and precipitation series. Int. J. Climatol., 23: 679–692. doi:
10.1002/joc.906

References
Wijngaard, J. B., Klein Tank, A. M. G. and Können, G. P. (2003), Homogeneity of 20th cen-
tury European daily temperature and precipitation series. Int. J. Climatol., 23: 679–692. doi:
10.1002/joc.906

Examples
# standard normal homogeneity test, SD different from 1(SNHT) for Turin 1961-2003
testTurin<- SNHTabsoluteII(yearly.average.temperature.Turin.Milan[,2])

# standard normal homogeneity test, SD different from 1(SNHT) for Milan 1961-2003
testMilan<- SNHTabsoluteII(yearly.average.temperature.Turin.Milan[,3])

plot(1961:2002,testTurin,type='l',col='cyan',ylim=c(0,30),
main='standard normal homogeneity test (SNHT), SD different from 1 for 1961-2003',
xlab='Years',ylab='test value')
par(new=TRUE)
plot(1961:2002,testMilan,type='l',col='magenta',ylim=c(0,30),xlab='',ylab='')
legend("top",c('Turin','Milan'),text.col=c('cyan','magenta'))

SNHTabsoluteTrend standard normal homogeneity test (SNHT) absolute homogeneity test


for trends

Description
SNHTabsoluteTrend returns the result of the standard normal homogeneity test (SNHT) absolute
homogeneity test for trends applied to a time series.

Usage
SNHTabsoluteTrend(dataSeries)

Arguments
dataSeries time series of climate data

Value
SNHTdata T SNHT absolute homogeneity test for trends
PosStartTrend estimated start position of the trend
SNHTrelative 65

Author(s)
Jose Gama

Source
ALEXANDERSSON, H. and MOBERG, A. (1997), HOMOGENIZATION OF SWEDISH TEM-
PERATURE DATA. PART I: HOMOGENEITY TEST FOR LINEAR TRENDS. Int. J. Climatol.,
17: 25–34. doi: 10.1002/(SICI)1097-0088(199701)17:1<25::AID-JOC103>3.0.CO;2-J
Tuomenvirta, H., 2002: Homogeneity testing and adjustment of climatic time series in Finland.
Geophysica, 38(1-2), 15-41.

References
ALEXANDERSSON, H. and MOBERG, A. (1997), HOMOGENIZATION OF SWEDISH TEM-
PERATURE DATA. PART I: HOMOGENEITY TEST FOR LINEAR TRENDS. Int. J. Climatol.,
17: 25–34. doi: 10.1002/(SICI)1097-0088(199701)17:1<25::AID-JOC103>3.0.CO;2-J
Tuomenvirta, H., 2002: Homogeneity testing and adjustment of climatic time series in Finland.
Geophysica, 38(1-2), 15-41.

Examples
# standard normal homogeneity test for trends(SNHT) for Turin 1961-2003
testTurin<- SNHTabsoluteTrend(yearly.average.temperature.Turin.Milan[,2])$SNHTdata

# standard normal homogeneity test for trends(SNHT) for Milan 1961-2003


testMilan<- SNHTabsoluteTrend(yearly.average.temperature.Turin.Milan[,3])$SNHTdata

plot(1961:2002,testTurin,type='l',col='cyan',ylim=c(0,30),
main='standard normal homogeneity test (SNHT) for trends, 1961-2003',xlab='Years',ylab='test value')
par(new=TRUE)
plot(1961:2002,testMilan,type='l',col='magenta',ylim=c(0,30),xlab='',ylab='')
legend("top",c('Turin','Milan'),text.col=c('cyan','magenta'))

SNHTrelative standard normal homogeneity test (SNHT) relative homogeneity test

Description
SNHTrelative returns the result of the standard normal homogeneity test (SNHT) relative homo-
geneity test applied to a time series.

Usage
SNHTrelative(dataSeries,refSeries=NA, diffFlag=TRUE)
66 SNHTrelative2SDs

Arguments
dataSeries time series of climate data
refSeries dataframe with climate data (reference)
diffFlag logical TRUE=difference, FALSE=ratio

Value
The result of the SNHT relative homogeneity test.

Author(s)
Jose Gama

Source
ALEXANDERSSON, H. and MOBERG, A. (1997), HOMOGENIZATION OF SWEDISH TEM-
PERATURE DATA. PART I: HOMOGENEITY TEST FOR LINEAR TRENDS. Int. J. Climatol.,
17: 25–34. doi: 10.1002/(SICI)1097-0088(199701)17:1<25::AID-JOC103>3.0.CO;2-J
Tuomenvirta, H., 2002: Homogeneity testing and adjustment of climatic time series in Finland.
Geophysica, 38(1-2), 15-41.

References
ALEXANDERSSON, H. and MOBERG, A. (1997), HOMOGENIZATION OF SWEDISH TEM-
PERATURE DATA. PART I: HOMOGENEITY TEST FOR LINEAR TRENDS. Int. J. Climatol.,
17: 25–34. doi: 10.1002/(SICI)1097-0088(199701)17:1<25::AID-JOC103>3.0.CO;2-J
Tuomenvirta, H., 2002: Homogeneity testing and adjustment of climatic time series in Finland.
Geophysica, 38(1-2), 15-41.

SNHTrelative2SDs standard normal homogeneity test (SNHT) relative homogeneity test


for two different SDs

Description
SNHTrelative2SDs returns the result of the standard normal homogeneity test (SNHT) relative
homogeneity test for two different SDs applied to a time series.

Usage
SNHTrelative2SDs(dataSeries,refSeries=NA, diffFlag=TRUE)

Arguments
dataSeries time series of climate data
refSeries dataframe with climate data (reference)
diffFlag logical TRUE=difference, FALSE=ratio
SNHTrelativeDoubleShift 67

Value
The result of the SNHT relative homogeneity test for two different SDs.

Author(s)
Jose Gama

Source
ALEXANDERSSON, H. and MOBERG, A. (1997), HOMOGENIZATION OF SWEDISH TEM-
PERATURE DATA. PART I: HOMOGENEITY TEST FOR LINEAR TRENDS. Int. J. Climatol.,
17: 25–34. doi: 10.1002/(SICI)1097-0088(199701)17:1<25::AID-JOC103>3.0.CO;2-J
Tuomenvirta, H., 2002: Homogeneity testing and adjustment of climatic time series in Finland.
Geophysica, 38(1-2), 15-41.

References
ALEXANDERSSON, H. and MOBERG, A. (1997), HOMOGENIZATION OF SWEDISH TEM-
PERATURE DATA. PART I: HOMOGENEITY TEST FOR LINEAR TRENDS. Int. J. Climatol.,
17: 25–34. doi: 10.1002/(SICI)1097-0088(199701)17:1<25::AID-JOC103>3.0.CO;2-J
Tuomenvirta, H., 2002: Homogeneity testing and adjustment of climatic time series in Finland.
Geophysica, 38(1-2), 15-41.

SNHTrelativeDoubleShift
standard normal homogeneity test (SNHT) relative homogeneity test
for two shifts

Description
SNHTrelativeDoubleShift returns the result of the standard normal homogeneity test (SNHT)
relative homogeneity test for two shifts applied to a time series.

Usage
SNHTrelativeDoubleShift(dataSeries,refSeries=NA, diffFlag=TRUE)

Arguments
dataSeries time series of climate data
refSeries dataframe with climate data (reference)
diffFlag logical TRUE=difference, FALSE=ratio

Value
SNHTdata T SNHT relative homogeneity test for trends
PosSecondShift estimated position of the second shift
68 SNHTrelativeII

Author(s)
Jose Gama

Source
ALEXANDERSSON, H. and MOBERG, A. (1997), HOMOGENIZATION OF SWEDISH TEM-
PERATURE DATA. PART I: HOMOGENEITY TEST FOR LINEAR TRENDS. Int. J. Climatol.,
17: 25–34. doi: 10.1002/(SICI)1097-0088(199701)17:1<25::AID-JOC103>3.0.CO;2-J
Tuomenvirta, H., 2002: Homogeneity testing and adjustment of climatic time series in Finland.
Geophysica, 38(1-2), 15-41.

References
ALEXANDERSSON, H. and MOBERG, A. (1997), HOMOGENIZATION OF SWEDISH TEM-
PERATURE DATA. PART I: HOMOGENEITY TEST FOR LINEAR TRENDS. Int. J. Climatol.,
17: 25–34. doi: 10.1002/(SICI)1097-0088(199701)17:1<25::AID-JOC103>3.0.CO;2-J
Tuomenvirta, H., 2002: Homogeneity testing and adjustment of climatic time series in Finland.
Geophysica, 38(1-2), 15-41.

SNHTrelativeII standard normal homogeneity test (SNHT) relative homogeneity test,


SD different from 1

Description
SNHTrelativeII returns the result of the standard normal homogeneity test (SNHT) relative ho-
mogeneity test with standard deviation different from 1, applied to a time series.

Usage
SNHTrelativeII(dataSeries,refSeries=NA, diffFlag=TRUE)

Arguments
dataSeries time series of climate data
refSeries dataframe with climate data (reference)
diffFlag logical TRUE=difference, FALSE=ratio

Value
The result of the SNHT relative homogeneity test with SD != 1.

Author(s)
Jose Gama
SNHTrelativeTrend 69

Source
Wijngaard, J. B., Klein Tank, A. M. G. and Können, G. P. (2003), Homogeneity of 20th cen-
tury European daily temperature and precipitation series. Int. J. Climatol., 23: 679–692. doi:
10.1002/joc.906

References
Wijngaard, J. B., Klein Tank, A. M. G. and Können, G. P. (2003), Homogeneity of 20th cen-
tury European daily temperature and precipitation series. Int. J. Climatol., 23: 679–692. doi:
10.1002/joc.906

SNHTrelativeTrend standard normal homogeneity test (SNHT) relative homogeneity test


for trends

Description
SNHTrelativeTrend returns the result of the standard normal homogeneity test (SNHT) relative
homogeneity test for trends applied to a time series.

Usage
SNHTrelativeTrend(dataSeries,refSeries=NA, diffFlag=TRUE)

Arguments
dataSeries time series of climate data
refSeries dataframe with climate data (reference)
diffFlag logical TRUE=difference, FALSE=ratio

Value
SNHTdata T SNHT relative homogeneity test for trends
PosStartTrend estimated start position of the trend

Author(s)
Jose Gama

Source
ALEXANDERSSON, H. and MOBERG, A. (1997), HOMOGENIZATION OF SWEDISH TEM-
PERATURE DATA. PART I: HOMOGENEITY TEST FOR LINEAR TRENDS. Int. J. Climatol.,
17: 25–34. doi: 10.1002/(SICI)1097-0088(199701)17:1<25::AID-JOC103>3.0.CO;2-J
Tuomenvirta, H., 2002: Homogeneity testing and adjustment of climatic time series in Finland.
Geophysica, 38(1-2), 15-41.
70 Sqplot

References

ALEXANDERSSON, H. and MOBERG, A. (1997), HOMOGENIZATION OF SWEDISH TEM-


PERATURE DATA. PART I: HOMOGENEITY TEST FOR LINEAR TRENDS. Int. J. Climatol.,
17: 25–34. doi: 10.1002/(SICI)1097-0088(199701)17:1<25::AID-JOC103>3.0.CO;2-J
Tuomenvirta, H., 2002: Homogeneity testing and adjustment of climatic time series in Finland.
Geophysica, 38(1-2), 15-41.

Sqplot Number of elements for a plot to be nearly square

Description

Sqplot returns the number of elements for a plot to be nearly square.

Usage

Sqplot(n)

Arguments

n number of elements

Value

vector with number of rows and columns.

Author(s)

Jose Gama

Examples

Sqplot(10)
TietjenMoore 71

TietjenMoore Tietjen Moore statistic

Description

TietjenMoore returns the Tietjen Moore statistic.

Usage

TietjenMoore(dataSeries,k)

Arguments

dataSeries time series of climate data


k number of outliers

Value

The Tietjen Moore statistic.

Author(s)

Jose Gama

Source

NIST/SEMATECH e-Handbook of Statistical Methods, 2013 http://www.itl.nist.gov/div898/


handbook/

References

NIST/SEMATECH e-Handbook of Statistical Methods, 2013 http://www.itl.nist.gov/div898/


handbook/

Examples

TietjenMoore(c(2, 4, 6, 7, 11, 21, 81, 90, 105, 121), 2)


72 TurningPointsTest

TrimmedMean trimmed mean

Description
TrimmedMean returns the trimmed mean of a time series.

Usage
TrimmedMean(dataSeries, percentTrim=0.1)

Arguments
dataSeries time series
percentTrim percentage to trim

Value
The trimmed mean of a time series.

Author(s)
Jose Gama

Examples
TrimmedMean(1:10)

TurningPointsTest Turning Points (non-parametric test for randomness)

Description
TurningPointsTest returns the result of the Turning Points (non-parametric test for randomness)
applied to a time series.

Usage
TurningPointsTest(dataSeries)

Arguments
dataSeries vector with climate data

Value
The result of the Turning Points test.
ValuesBetween2Dates 73

Author(s)

Jose Gama

Source

Chiew F. and Siriwardena L., 2005 CRC for Catchment Hydrology Trend 1.0.2 User Guide, chapter
4.2.11 Rank Difference Test, pp. 21 http://www.toolkit.net.au/Tools/TREND/documentation
Kundzewicz, Z.W. and Robson, A., 2000 Detecting Trend and Other Changes in Hydrological Data.
World Climate Program - Water, WMO/UNESCO, WCDMP-45, WMO/TD 1013, Geneva, 157 pp.
Grayson, R.B., Argent, R.M., Nathan, R.J., McMahon, T.A. and Mein, R., 1996 Hydrological
Recipes: Estimation Techniques in Australian Hydrology. Cooperative Research Centre for Catch-
ment Hydrology, Australia, 125 pp.

References

Chiew F. and Siriwardena L., 2005 CRC for Catchment Hydrology Trend 1.0.2 User Guide, chapter
4.2.11 Rank Difference Test, pp. 21 http://www.toolkit.net.au/Tools/TREND/documentation
Kundzewicz, Z.W. and Robson, A., 2000 Detecting Trend and Other Changes in Hydrological Data.
World Climate Program - Water, WMO/UNESCO, WCDMP-45, WMO/TD 1013, Geneva, 157 pp.
Grayson, R.B., Argent, R.M., Nathan, R.J., McMahon, T.A. and Mein, R., 1996 Hydrological
Recipes: Estimation Techniques in Australian Hydrology. Cooperative Research Centre for Catch-
ment Hydrology, Australia, 125 pp.

Examples
x=c(681,3661,8625,2475,573,2794,10190,5143,4139,8945,7295,19883,12119,8772,
8848,16309,16254,2303,7671,3985,
13742,5333,4859,12381,12137,6075,4669,378,7507,3891,13046,12954,2445,14759,
20200,16331,6922,6739,11629,
7351,2445,9960,10,11786,10214,11216,8393,10005,6896,11632)
TurningPointsTest(x)

ValuesBetween2Dates Get values between two dates

Description

ValuesBetween2Dates returns all the values between two dates, inclusively.

Usage

ValuesBetween2Dates(dataYearSeries,FromDate,ToDate)
74 ValuesBetween2years

Arguments
dataYearSeries dataframe with climate data
FromDate starting date
ToDate ending date

Value
values between two dates.

Author(s)
Jose Gama

Examples
# xgdcnCA008201000.dat is from ECA COLLEGEVILLE temperature
setwd(system.file('extdata/', package='climtrends'))
dailyCollegeville <- ReadGHCNymd('xgdcnCA008201000.dat')
dailyCollegeville0910 <- ValuesBetween2Dates(dailyCollegeville,'2009-01-01','2010-12-30')

ValuesBetween2years Get values between two years

Description
ValuesBetween2years returns all the values between 2 years, that is, the 1st and the last days of a
year range.

Usage
ValuesBetween2years(dataYearSeries,intFromYear,intToYear)

Arguments
dataYearSeries dataframe with climate data
intFromYear starting year
intToYear ending year

Value
values between two years.

Author(s)
Jose Gama
VDTR 75

Examples
# xgdcnCA008201000.dat is from ECA COLLEGEVILLE temperature
setwd(system.file('extdata/', package='climtrends'))
dailyCollegeville=ReadGHCNymd('xgdcnCA008201000.dat')
yearlyCollegeville=YearFuncFromDay(dailyCollegeville)
colnames(yearlyCollegeville) <- c('year','temperature')
yearlyCollegeville<-ValuesBetween2years(yearlyCollegeville,1918,1993)

VDTR annual mean of the absolute day-to-day differences of DTR (VDTR)

Description
VDTR returns the annual mean of the absolute day-to-day differences of the diurnal temperature
range (VDTR).

Usage
VDTR(yearDF,datecol,valcol)

Arguments
yearDF matrix with diurnal temperature range data
datecol column with dates
valcol column with diurnal temperature range data

Value
absolute day-to-day differences of the diurnal temperature range (VDTR).

Author(s)
Jose Gama

Source
Wijngaard, J. B., Klein Tank, A. M. G. and Können, G. P. (2003), Homogeneity of 20th cen-
tury European daily temperature and precipitation series. Int. J. Climatol., 23: 679–692. doi:
10.1002/joc.906

References
Wijngaard, J. B., Klein Tank, A. M. G. and Können, G. P. (2003), Homogeneity of 20th cen-
tury European daily temperature and precipitation series. Int. J. Climatol., 23: 679–692. doi:
10.1002/joc.906
76 Von.Neumann.Ratio.Test.Critical.Values

Examples
# data from the ECA station series of Eelde (The Netherlands) from 1900 to 2000
EtmgegData<-ReadEtmgegFile('etmgeg_280.txt',c(2,12,13,15))
until2000<-EtmgegData[which(EtmgegData[,1]<'2001-01-01'),] # zr are the data until 2000
until2000[,2:4]<-until2000[,2:4]/10 # divide by 10 to get a scale of 1 degrees Celsius
# calculate DTR
u2000DTR<-until2000[,-2] #get rid of the mean
u2000DTR[,2]<-u2000DTR[,3]-u2000DTR[,2] #DTR=MAX-MIN
u2000DTR<-u2000DTR[,-3]
u2000mDTR<-YearMeanFromDay(u2000DTR,1,2)
# calculate VDTR
u2000VDTR<-VDTR(u2000DTR,1,2)

Von.Neumann.Ratio.Test.Critical.Values
Critical values for the Von Neumann ratio test

Description
Von.Neumann.Ratio.Test.Critical.Values contains the critical values for the Von Neumann
ratio test.

Usage
Von.Neumann.Ratio.Test.Critical.Values

Format
This data frame contains 2 columns (1 and 6 rows (n=20, 30, 40, 50, 70 and 100) of data.

Author(s)
Jose Gama

Source
Von Neumann J., 1941 Distribution of the ratio of the mean square successive difference to the
variance. Annals of Mathematical Statistics 13: 367–395.

References
Von Neumann J., 1941 Distribution of the ratio of the mean square successive difference to the
variance. Annals of Mathematical Statistics 13: 367–395.

Examples
data(Von.Neumann.Ratio.Test.Critical.Values)
Von.Neumann.Ratio.Test.Critical.Values
VonNeumannRatio 77

VonNeumannRatio Pettitt test

Description
VonNeumannRatio returns the result of the Von Neumann ratio test applied to a time series.

Usage
VonNeumannRatio(dataSeries)

Arguments
dataSeries time series of climate data

Value
The result of the Pettitt test.

Author(s)
Jose Gama

Source
Wijngaard, J. B., Klein Tank, A. M. G. and Können, G. P. (2003), Homogeneity of 20th cen-
tury European daily temperature and precipitation series. Int. J. Climatol., 23: 679–692. doi:
10.1002/joc.906
Von Neumann J., 1941 Distribution of the ratio of the mean square successive difference to the
variance. Annals of Mathematical Statistics 13: 367–395.

References
Wijngaard, J. B., Klein Tank, A. M. G. and Können, G. P. (2003), Homogeneity of 20th cen-
tury European daily temperature and precipitation series. Int. J. Climatol., 23: 679–692. doi:
10.1002/joc.906
Von Neumann J., 1941 Distribution of the ratio of the mean square successive difference to the
variance. Annals of Mathematical Statistics 13: 367–395.

Examples
# Von Neumann ratio test for Turin 1961-2003
testTurin<- VonNeumannRatio(yearly.average.temperature.Turin.Milan[,2])

# Von Neumann ratio test for Milan 1961-2003


testMilan<- VonNeumannRatio(yearly.average.temperature.Turin.Milan[,3])
78 VonNeumannRatioRank

VonNeumannRatioRank Von Neumann ratio rank test

Description

VonNeumannRatioRank returns the result of the Von Neumann ratio rank test applied to a time
series.

Usage

VonNeumannRatioRank(dataSeries)

Arguments

dataSeries time series of climate data

Value

The result of the Von Neumann ratio rank test.

Author(s)

Jose Gama

Source

Robert Bartels, 1982 The Rank Version of von Neumann’s Ratio Test for Randomness Journal of the
American Statistical Association Vol. 77, No. 377 pp. 40-46 http://www.jstor.org/stable/
2287767

References

Robert Bartels, 1982 The Rank Version of von Neumann’s Ratio Test for Randomness Journal of the
American Statistical Association Vol. 77, No. 377 pp. 40-46 http://www.jstor.org/stable/
2287767

Examples
# Von Neumann ratio rank test for Turin 1961-2003
testTurin<- VonNeumannRatioRank(yearly.average.temperature.Turin.Milan[,2])

# Von Neumann ratio rank test for Milan 1961-2003


testMilan<- VonNeumannRatioRank(yearly.average.temperature.Turin.Milan[,3])
WetDayCount 79

WetDayCount Get number of wet days

Description
WetDayCount returns the number of wet days with a certain threshold in mm).

Usage
WetDayCount(yearDF, datecol, valcol, vthreshold)

Arguments
yearDF dataframe with climate data
datecol column with dates
valcol column with precipitation data
vthreshold threshold in mm

Value
number of wet days.

Author(s)
Jose Gama

Examples
setwd(system.file('extdata/', package='climtrends'))
z<-ReadECAdata('RR_SOUID101991.txt')
d1900.2000<-z[which(z[,1]<'2001-01-01'),]
d1900.2000<-d1900.2000[which(d1900.2000[,1]>='1900-01-01'),]
y1900.2000w<-WetDayCount(d1900.2000,1,2,10)

woOp x without y

Description
%w/o% returns TRUE if there are no matching values

Usage
x %w/o% y
80 Worsley.Likelihood.Ratio.Test.Critical.Values

Arguments
x string
y another string

Value
logical, TRUE = no matching values

Author(s)
Jose’ Gama

Source
R documentation, Value Matching /urlhttp://stat.ethz.ch/R-manual/R-patched/library/base/html/match.html

References
R documentation, Value Matching /urlhttp://stat.ethz.ch/R-manual/R-patched/library/base/html/match.html

Examples
## Not run:
(1:10)
1950:1970

## End(Not run)

Worsley.Likelihood.Ratio.Test.Critical.Values
Critical values for Worsley’s likelihood ratio test

Description
Worsley.Likelihood.Ratio.Test.Critical.Values contains the critical values for the Wors-
ley’s likelihood ratio test.

Usage
Worsley.Likelihood.Ratio.Test.Critical.Values

Format
This data frame contains 6 columns (Q90 and 7 rows (n=10, 20, 30, 40, 50, 100 and Inf) of data.

Author(s)
Jose Gama
WorsleyLikelihoodRatio 81

Source
Worsley, K.J., 1979 On the likelihood ratio test for a shift in location of normal populations. J. Am.
Stat. Assoc., 74: 365–367.

References
Worsley, K.J., 1979 On the likelihood ratio test for a shift in location of normal populations. J. Am.
Stat. Assoc., 74: 365–367.

Examples
data(Worsley.Likelihood.Ratio.Test.Critical.Values)
Worsley.Likelihood.Ratio.Test.Critical.Values

WorsleyLikelihoodRatio
Worsley’s Likelihood Ratio test

Description
WorsleyLikelihoodRatio returns the result of Worsley’s Likelihood Ratio test applied to a time
series.

Usage
WorsleyLikelihoodRatio(yearDF, datecol=1,valcol=2, returnZk=FALSE)

Arguments
yearDF dataframe with climate data
datecol column with dates
valcol column with values
returnZk return calculated data Zk

Value
The result of Worsley’s Likelihood Ratio test.

Author(s)
Jose Gama

Source
Wijngaard, J. B., Klein Tank, A. M. G. and Können, G. P. (2003), Homogeneity of 20th cen-
tury European daily temperature and precipitation series. Int. J. Climatol., 23: 679–692. doi:
10.1002/joc.906
82 YearFuncFromDay

References
Wijngaard, J. B., Klein Tank, A. M. G. and Können, G. P. (2003), Homogeneity of 20th cen-
tury European daily temperature and precipitation series. Int. J. Climatol., 23: 679–692. doi:
10.1002/joc.906

Examples
demo(demoWorsleyLR)

YearFuncFromDay Annual values converted from daily values

Description
YearFuncFromDay returns annual values converted by a function from daily values.
YearMeanFromDay returns annual values averaged from daily values.

Usage
YearFuncFromDay(yearDF, datecol=1,valcol=2, yfunc=mean)

Arguments
yearDF dataframe with climate data
datecol column with dates
valcol column with values
yfunc function to apply on the data

Value
Annual values.

Author(s)
Jose Gama

Examples
# xgdcnCA008201000.dat is from ECA COLLEGEVILLE temperature
setwd(system.file('extdata/', package='climtrends'))
dailyCollegeville=ReadGHCNymd('xgdcnCA008201000.dat')
yearlyCollegeville=YearFuncFromDay(dailyCollegeville)
yearly.average.temperature.Turin.Milan 83

yearly.average.temperature.Turin.Milan
Yearly average temperature in Turin, Milan

Description
yearly.average.temperature.Turin.Milan contains the yearly average temperature in Turin,
Milan.

Usage
yearly.average.temperature.Turin.Milan

Format
This data frame contains 6 columns (Q90 and 7 rows (n=10, 20, 30, 40, 50, 100 and Inf) of data.

Author(s)
Jose Gama

Source
Historical Climatology Group, 2005 Training session on homogenisation methods Bologna 17-18
May, 2005

References
Historical Climatology Group, 2005 Training session on homogenisation methods Bologna 17-18
May, 2005

Examples
data(yearly.average.temperature.Turin.Milan)
str(yearly.average.temperature.Turin.Milan)
Index

∗Topic datasets FindOutliersMAD, 22


annual.precipitation.totals.Madison, FindOutliersQuant, 23
5 FindOutliersSD, 24
Buishand.Critical.Values, 7 FindOutliersTietjenMooreTest, 25
Pettitt.Critical.Values, 40 FindOutliersTrimmedMeans, 26
Rank.Von.Neumann.Ratio.Test.Critical.Values, FindOutliersZscore, 27
44 FirstMonthOfSeason, 27
SNHT.Critical.Values, 57 GetInfoHomogenization, 28
SNHT.TwoDifferentSDs.Critical.Values, GetNDP, 29
58 GetShiftValue, 29
SNHT.TwoShifts.Critical.Values, 59 IsLeapYear, 30
Von.Neumann.Ratio.Test.Critical.Values, LastDayOfTheMonth, 31
76 LevelSignifMarks, 31
Worsley.Likelihood.Ratio.Test.Critical.Values,ListContinuousDays, 32
80 ListHomogStats, 33
yearly.average.temperature.Turin.Milan, ListHomogTZ, 34
83 MedianCrossingTest, 35
∗Topic programming MonthlyAnomaliesFromDailyData, 36
AdjHomogenization, 4 MonthlyClimatologyFromDailyData,
AllfilesIEObyPathPattern, 4 37
AllReadUSGS2timeseries, 5 MonthlyFuncFromDay, 37
BSXFUN, 6 MonthTrendYearsFuncFromDay, 38
BuishandRangeTest, 8 peaksP, 39
CompleteMissingValuesDailyMean, 9 PettittTest, 40
CraddockTest, 10 PlotHomog, 41
CreateReferenceSeriesFromFilesMean, PlotSeriesAndRefSimple, 42
11 PlotSeriesDifference, 43
CreateReferenceSeriesFromFilesMeanCorrelations,
RankDifferenceTest, 45
12 RankSumTest, 46
CumulativeDeviations, 13 ReadClimexpKnmiNL, 47
DailyClimatologyFromDailyData, 14 ReadClimexpKnmiNL12month, 48
DistributionFreeCUSUM, 15 ReadCRDEC, 48
ESDstatistic, 16 ReadECAdata, 49
FillDailyGapsWithSomeValue, 17 ReadEtmgegFile, 49
FillYearlyGapsWithSomeValue, 18 ReadGHCNymd, 50
FindCommonPeriod, 19 ReadHERTTAdailyCSV, 51
FindOutliersESDtest, 19 ReadHERTTAdmyQdaily, 51
FindOutliersGrubbsTwosided, 20 ReadMeteoSwiss, 52
FindOutliersHampel, 21 ReadNdp040stationDat, 52

84
INDEX 85

ReadPSMSLmonthly, 53 CumulativeDeviationsQR
ReadUSGS2timeseries, 53 (CumulativeDeviations), 13
ReadUSHCN, 54
ReadYearAnd12MonthsData, 54 DailyClimatologyFromDailyData, 14
SiegelTukey, 55 DistributionFreeCUSUM, 15
SNHTabsolute, 60
SNHTabsolute2SDs, 61 ESDstatistic, 16
SNHTabsoluteDoubleShift, 62
SNHTabsoluteII, 63 FillDailyGapsWithSomeValue, 17
SNHTabsoluteTrend, 64 FillYearlyGapsWithSomeValue, 18
SNHTrelative, 65 FindCommonPeriod, 19
SNHTrelative2SDs, 66 FindOutliersESDtest, 19
SNHTrelativeDoubleShift, 67 FindOutliersGrubbsOnesidedMax
SNHTrelativeII, 68 (FindOutliersGrubbsTwosided),
SNHTrelativeTrend, 69 20
Sqplot, 70 FindOutliersGrubbsOnesidedMin
TietjenMoore, 71 (FindOutliersGrubbsTwosided),
TrimmedMean, 72 20
TurningPointsTest, 72 FindOutliersGrubbsTwosided, 20
ValuesBetween2Dates, 73 FindOutliersHampel, 21
ValuesBetween2years, 74 FindOutliersMAD, 22
VDTR, 75 FindOutliersModifiedZscore
VonNeumannRatio, 77 (FindOutliersZscore), 27
VonNeumannRatioRank, 78 FindOutliersQuant, 23
FindOutliersSD, 24
WetDayCount, 79
FindOutliersTietjenMooreTest, 25
woOp, 79
FindOutliersTrimmedMeans, 26
WorsleyLikelihoodRatio, 81
FindOutliersZscore, 27
YearFuncFromDay, 82
FirstMonthOfSeason, 27
%w/o% (woOp), 79
GetInfoHomogenization, 28
AdjHomogenization, 4 GetNDP, 29
AllfilesIEObyPathPattern, 4 GetShiftValue, 29
AllReadUSGS2timeseries, 5
annual.precipitation.totals.Madison, 5 IsLeapYear, 30

BSXFUN, 6 LastDayOfTheMonth, 31
Buishand.Critical.Values, 7 LastMonthOfSeason (FirstMonthOfSeason),
BuishandRangeTest, 8 27
LevelSignifMarks, 31
CompleteMissingValuesDailyMean, 9 ListContinuousDays, 32
CraddockTest, 10 ListHomogStats, 33
CreateReferenceSeriesFromFilesMean, 11 ListHomogTZ, 34
CreateReferenceSeriesFromFilesMeanCorrelations,
12 MedianCrossingTest, 35
MonthlyAnomaliesFromDailyData, 36
CreateReferenceSeriesFromFilesMeanCorrelationsTwoseries
MonthlyClimatologyFromDailyData, 37
(CreateReferenceSeriesFromFilesMeanCorrelations),
12 MonthlyFuncFromDay, 37
CumulativeDeviations, 13 MonthTrendYearsFuncFromDay, 38
86 INDEX

NegCurve (GetShiftValue), 29 SNHTrelativeTrend, 69


Sqplot, 70
peaksP, 39
Pettitt.Critical.Values, 40 TietjenMoore, 71
PettittTest, 40 TrimmedMean, 72
PlotHomog, 41 TurningPointsTest, 72
PlotSeriesAndRefSimple, 42
PlotSeriesDifference, 43 ValuesBetween2Dates, 73
ValuesBetween2years, 74
Rank.Von.Neumann.Ratio.Test.Critical.Values, VDTR, 75
44 Von.Neumann.Ratio.Test.Critical.Values,
RankDifferenceTest, 45 76
RankSumTest, 46 VonNeumannRatio, 77
ReadClimexpKnmiNL, 47 VonNeumannRatioRank, 78
ReadClimexpKnmiNL12month, 48
ReadCRDEC, 48 WetDayCount, 79
ReadECAdata, 49 woOp, 79
ReadECAdataIndexDTR (ReadECAdata), 49 Worsley.Likelihood.Ratio.Test.Critical.Values,
ReadEtmgegFile, 49 80
ReadGHCNymd, 50 WorsleyLikelihoodRatio, 81
ReadHERTTAdailyCSV, 51
YearFuncFromDay, 82
ReadHERTTAdmyQdaily, 51
yearly.average.temperature.Turin.Milan,
ReadMeteoSwiss, 52
83
ReadNdp040stationDat, 52
YearMeanFromDay (YearFuncFromDay), 82
ReadNdp040stationData
(ReadNdp040stationDat), 52
ReadNdp040stationHistory
(ReadNdp040stationDat), 52
ReadNdp040stationInventory
(ReadNdp040stationDat), 52
ReadPSMSLmonthly, 53
ReadUSGS2timeseries, 53
ReadUSHCN, 54
ReadYearAnd12MonthsData, 54

SiegelTukey, 55
SNHT.Critical.Values, 57
SNHT.TwoDifferentSDs.Critical.Values,
58
SNHT.TwoShifts.Critical.Values, 59
SNHTabsolute, 60
SNHTabsolute2SDs, 61
SNHTabsoluteDoubleShift, 62
SNHTabsoluteII, 63
SNHTabsoluteTrend, 64
SNHTrelative, 65
SNHTrelative2SDs, 66
SNHTrelativeDoubleShift, 67
SNHTrelativeII, 68

You might also like