SpatioTemporal (version 1.1.9.1)

plot.STdata: Different Plots for STdata/STmodel object

Description

plot method for class STdata or STmodel. Provides several different plots of the data. When calles for STmodel, STmodel$locations acts as STdata$covars.

Usage

# S3 method for STdata
plot(x, y = c("obs", "res", "acf", "pacf", "loc", "loc.obs"),
  ID = x$covars$ID[1], type = x$covars$type, col = NULL, pch = NULL,
  cex = NULL, lty = NULL, legend.loc = "topleft", legend.names = NULL,
  add = FALSE, ...)

# S3 method for STmodel plot(x, y = "obs", ID = x$locations$ID[1], type = x$locations$type, ...)

Arguments

x

STdata/STmodel object to plot.

y

Type of plot, options are "obs", "res", "acf", "pacf", "loc", or "loc.obs", see details below.

ID

The location for which we want to plot observations. Either a string matching the names in x$covars$ID or an integer; if an integer the functions will plot data from ID=x$covars$ID[ID].

type

Factorial of length(x$covars$type), used by "loc" and "loc.obs" to determine how many groups should be plotted and colour/type coded.

col, pch, cex, lty

Colour, type of points, size of points, and type of lines. Exact meaning depends on value of y, see Details.

legend.loc

The location of the legend, for "loc" and "loc.obs". See legend.

legend.names

A vector of character strings to be used in the legend, for "loc" and for "loc.obs"

add

Add to existing plot, only relevant if y is "obs", "res", "loc", or "loc.obs".

...

Additional parameters passed to plot or plot.acf.

Value

Nothing

Details

Performs a variety of different plots determined by y:

"obs"

Plot observations for location ID, along with the fitted temporal trend.

"res"

Plot residuals for the fitted temporal trend at location ID; adds the y=0 line for reference.

"acf"

Plot autocorrelation function for the residuals from the fitted temporal trend at location ID.

"pacf"

Plot partial autocorrelation function for the residuals from the fitted temporal trend at location ID.

"loc"

Plot the observation location index number as a function of the observation date, for all observations. Possibly coded by the type of observations locations.

"loc.obs"

Plot the observation value as a function of the observation date, for all observations. Possibly coded by the type of observations locations.

For y=c("obs","res") the first element of col,pch,cex,lty is used to specify plotting of the observations, and the second element is used to specify plotting of the fitted temporal trend, or 0-line for "res". Defaults: col=1, pch=c(1,NA), cex=1, lty=c(NA,1). Elements of length one are repeated.

For y=c("acf","pacf") col,pch,cex,lty are ignored.

For y=c("loc","loc.obs") col,pch,cex are used to specify the points for each of the different levels in type and should be of length 1 or length(levels(type)). lty is ignored. Default: col=1:length(levels(type)), pch=19, cex=.1

For y=c("loc","loc.obs") a legend is added if legend.loc!=NULL. The vector legend.names should have length equal to the number of unique location types. The default legend names are levels(type).

See Also

Other STdata methods: createSTdata, print.STdata, print.summary.STdata, qqnorm.predCVSTmodel, scatterPlot.predCVSTmodel, summary.STdata

Other STmodel methods: MCMC.STmodel, c.STmodel, createSTmodel, estimate.STmodel, estimateCV.STmodel, predict.STmodel, print.STmodel, print.summary.STmodel, qqnorm.predCVSTmodel, scatterPlot.predCVSTmodel, simulate.STmodel, summary.STmodel

Examples

Run this code
# NOT RUN {
##load data
data(mesa.model)

##default plot
plot(mesa.model)

##plot monitor locations
plot(mesa.model, "loc")

##different names/colours/etc
plot(mesa.model, "loc", main="A nice plot", col=c("green","blue"),
    legend.names=c("Sites of one type", "..and of the other"),
    legend.loc="topleft")

##composite time-trend
plot(mesa.model, "loc.obs", legend.loc="bottomleft", cex=.5, pch=c(3,4))

##plot tim-series for the first site,
layout(matrix(c(1,2,3,1,2,4),3,2))
plot(mesa.model, "obs", ID=1, col=c("red", "black"))
##residuals from the temporal trends,
plot(mesa.model, "res", ID=1, col=c("black","grey"))
##afc 
plot(mesa.model, "acf", ID=1)
##... and pafc for the residuals
plot(mesa.model, "pacf", ID=1, ci.col="red")

##Different site and with no temporal trend.
mesa.model <- updateTrend(mesa.model, n.basis=0)
layout(matrix(c(1,2,3,1,2,4),3,2))
plot(mesa.model, "obs", ID="60370016")
plot(mesa.model, "res", ID="60370016")
plot(mesa.model, "acf", ID="60370016")
plot(mesa.model, "pacf", ID="60370016")
# }

Run the code above in your browser using DataLab