detect_break: Detect step changes

Description Usage Arguments Value Examples

View source: R/detect_break.R

Description

This function checks whether there are step changes present in a time series at a pre-specified time (generally 2005 for CMIP5 historical to RCP scenario transition).

Usage

1
detect_break(x, breaktime = 2005, n = 50, detrend = TRUE, log = TRUE)

Arguments

x

input object of type NetCDF

breaktime

last time step (year) of first period

n

number of years in climatology (before and after break point)

detrend

logical, should linear trend be accounted for?

log

logical, should log-transformed p-values be returned?

Value

A list containing the p-values for each suspected break (per region and season) and the log aggregate p-value for all seasons using Fisher's method to combine the break tests for individual seasons.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## set up time series with increasing break at 50/51
nseas <- 4
xx <- outer(seq(0,3/sqrt(50),length=50), rep(c(0,1), each=50*nseas), '*')
xx <- xx + rnorm(length(xx)) + rep(seq(0,10,length=ncol(xx)), each=nrow(xx))
class(xx) <- 'NetCDF'
attr(xx, 'time') <- seq(1, length=100*nseas, by=1/nseas)

## detect the break
dd <- detect_break(xx, 50, log=FALSE)

## look at results
plot(dd$fish, type='h', lend=3, lwd=2)
abline(h=0.05, lty=2)

jonasbhend/geoutils documentation built on May 19, 2019, 7:27 p.m.