Learn R Programming

SpatioTemporal (version 0.9.2)

plotMesaData: Illustrates the Observations as Timeseries

Description

Plots either the time-series of observations or residuals of a regression of observations on the temporal trends in mesa.data$trend; for the residuals this plots either the raw residuals or the (partial) autocorrelation function.

Usage

plotMesaData(mesa.data, ID, add = FALSE, type = "obs",
             lag.max = NULL)

Arguments

mesa.data
A data structure containing the observations, either mesa.data or mesa.data.model.
ID
The location for which we want to plot observations. Either a string matching the names in mesa.data$location$ID or an integer; if an integer the functions will plot data from ID=mesa.data.model$location$ID[ID].
add
Add to an existing plot, or start a new plot. Ignored if type="acf" or "pacf".
type
A string indicating which type of plot to construct. Valid options are "obs", "res", "acf", and "pacf".
lag.max
Maximum lag for which to calculate the (p)acf, see acf for details.

Value

  • Does not return anything.

encoding

latin1

Details

The function plots either timeseries of observations at the location specified by ID, or residuals from the regression of observations on the smooth temporal trends in mesa.data$trend.

When plotting observations (type="obs") this plots both observations and the best fit of the trend functions to the observations. type="res" plots the residuals of observations fitted to the temporal trends; this also adds the y=0 line for reference. type="acf" or type="pacf" plots the autocorrelation function or partial autocorrelation function of the residuals.

See Also

plotMonitoringLoc, printMesaDataNbrObs for additional data summaries.

Examples

Run this code
##load data
data(mesa.data)

##plot the first site,
par(mfrow=c(4,1),mar=c(2.5,2.5,3,1))
plotMesaData(mesa.data, ID=1, type="obs")
##residuals from the temporal trends,
plotMesaData(mesa.data, ID=1, type="res")
##afc 
plotMesaData(mesa.data, ID=1, type="acf")
##... and pafc for the residuals
plotMesaData(mesa.data, ID=1, type="pacf")

##Same as above but calling the 2nd site by name
par(mfrow=c(4,1),mar=c(2.5,2.5,3,1))
plotMesaData(mesa.data, ID="60370016", type="obs")
plotMesaData(mesa.data, ID="60370016", type="res")
plotMesaData(mesa.data, ID="60370016", type="acf")
plotMesaData(mesa.data, ID="60370016", type="pacf")

Run the code above in your browser using DataLab