Learn R Programming

SpatioTemporal (version 1.1.7)

qqnorm.predCVSTmodel: QQ-norm for STdata/STmodel/predCVSTmodel objects

Description

qqnorm method for classes STdata/STmodel/predCVSTmodel. Used for data and residual analysis of the cross validation.

Usage

# S3 method for predCVSTmodel
qqnorm (y, ID = "all",
    main = "Q-Q plot for CV residuals", group = NULL,
    col = 1, norm = FALSE, line = 0, org.scale = TRUE, ...)

# S3 method for STdata qqnorm (y, ID = "all", main = "Q-Q plot for observations", group = NULL, col = 1, line = 0, ...)

# S3 method for STmodel qqnorm (y, ID = "all", main = "Q-Q plot for observations", group = NULL, col = 1, line = 0, ...)

Arguments

norm

TRUE/FALSE, plot normalised (mean=0, sd=1) or raw cross-validation residuals. If norm=TRUE a 0-1 line is added, to indicate what normalised residuals should look like.

org.scale

TRUE/FALSE scatter plots on the original untransformed scale, or using exp(y). Only relevant if x was computed using transform in predictCV.STmodel (as pass through argument to predict.STmodel)

y

STdata/STmodel/predCVSTmodel object for the qqnorm.

ID

The location for which we want to norm-plot observations/residuals or "all" to plot for all locations.

main

Title of the plot

group

Do the norm-plot both for all data and then for each subset defined by the factor/levels in group variable.

col

Colour of points in the plot, either a scalar or a vector with length matching the number of observations/residuals.

line

If non-zero add a qqline with lty=line, to the plot; if 0 do not add a line.

...

Arguments passed on to the plotting function, qqnorm.

Value

Nothing

See Also

Other predCVSTmodel methods: estimateCV, estimateCV.STmodel, plot.predCVSTmodel, plot.predictSTmodel, predictCV, predictCV.STmodel, print.predCVSTmodel, print.summary.predCVSTmodel, scatterPlot.predCVSTmodel, scatterPlot.STdata, scatterPlot.STmodel, summary.predCVSTmodel

Other STdata methods: createSTdata, plot.STdata, plot.STmodel, print.STdata, print.summary.STdata, scatterPlot.predCVSTmodel, scatterPlot.STdata, scatterPlot.STmodel, summary.STdata

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

Examples

Run this code
# NOT RUN {
################################
## Example for STdata/STmodel ##
################################
##load data
data(mesa.model)

##standard plot
qqnorm(mesa.model)
##add a line, and group (and colour) by AQS/FIXED
par(mfrow=c(2,2))
obs.type <- mesa.model$locations$type[match(mesa.model$obs$ID,
                                            mesa.model$locations$ID)]
qqnorm(mesa.model, line=1, group=obs.type, col=obs.type)

##colour code by season and split by type
##First create a vector dividing data into four seasons
I.season <- as.factor(as.POSIXlt(mesa.model$obs$date)$mon+1)
levels(I.season) <- c(rep("Winter",2), rep("Spring",3), 
                      rep("Summer",3), rep("Fall",3), "Winter") 

par(mfrow=c(2,2))
qqnorm(mesa.model, line=1, col=I.season, group=obs.type)
legend("bottomright", legend=as.character(levels(I.season)),
       pch=1, col=1:nlevels(I.season))

###############################
## Example for predCVSTmodel ##
###############################
##load data
data(pred.cv.mesa)

##standard plot
par(mfrow=c(1,1))
qqnorm(pred.cv.mesa, line=3)
##or for the normalised residuals
qqnorm(pred.cv.mesa, line=3, norm=TRUE)

##add a line, and group by AQS/FIXED
par(mfrow=c(2,2))
qqnorm(pred.cv.mesa, line=1, group=obs.type)

##and for normalised residuals, colour-coded by season
par(mfrow=c(2,2))
qqnorm(pred.cv.mesa, line=2, norm=TRUE,
       group=obs.type, col=I.season)
legend("bottomright", legend=as.character(levels(I.season)),
       pch=1, col=1:nlevels(I.season))
# }

Run the code above in your browser using DataLab