plot.gbmt {gbmt}R Documentation

Graphics for a group-based multivariate trajectory model

Description

Visualization of estimated and predicted trajectories.

Usage

## S3 method for class 'gbmt'
plot(x, group=NULL, unit=NULL, x.names=NULL, n.ahead=0, bands=TRUE, conf=0.95,
  observed=TRUE, equal.scale=FALSE, trim=0, ylim=NULL, xlab="", ylab="", titles=NULL,
  add.grid=TRUE, col=NULL, transparency=-1, add.legend=TRUE, pos.legend=c(0,0),
  cex.legend=0.6, mar=c(5.1,4.1,4.1,2.1), ...)

Arguments

x

Object of class gbmt.

group

Numerical value indicating the group for which the estimated trajectories should be displayed. If NULL (the default), the estimated trajectories for each group will be overlapped. Ignored if unit is not NULL.

unit

Character indicating the name of the unit for which estimated trajectories should be displayed. If NULL (the default), estimated group trajectories are displayed.

x.names

Character including the names of the indicators for which the estimated trajectory should be displayed. If NULL (the default), estimated trajectories of all indicators are displayed.

n.ahead

Non-negative integer value indicating the number of steps ahead to perform prediction. Default is 0, meaning no prediction.

bands

Logical value indicating whether the prediction bands for should be drawn. Default is TRUE.

conf

Numerical value indicating the confidence level for the prediction bands. Default is 0.05. Ignored if bands is FALSE.

observed

Logical indicating whether observed trajectories should be drawn. Default is TRUE. Ignored if both group and unit are NULL.

equal.scale

Logical indicating whether indicators should have the same scale across all groups. Default is FALSE. Ignored if ylim is not NULL or if unit is not NULL.

trim

Numerical value indicating the proportion of extreme values to trim when either equal.scale is TRUE. Ignored if observed is FALSE or both group and unit are NULL. Default is 0, meaning no trim.

ylim

vector of length 2 indicating the limits of the y-axis, which will be applied to all indicators. If NULL (the default), it will be determined independently for each indicator based on data, unless equal.scale is TRUE.

xlab

label for the x-axis, which will be applied to all indicators. Default is empty string.

ylab

label for the y-axis, which will be applied to all indicators. Default is empty strings.

titles

vector of titles for the indicators. If NULL, the name of the indicators is used as title.

add.grid

Logical value indicating whether the grid should be added. Default is TRUE.

col

Character or numerical vector indicating the color of group trajectories. If group is not NULL, only the first valid color is considered. If group is NULL and there are more than ng valid colors, only the first ng valid colors are considered, otherwise valid colors are recycled to achieve a total number equal to ng. If NULL (the default), colors of group trajectories will be determined automatically.

transparency

Numerical value between 0 and 100 indicating the trasparency of prediction regions. Value 75 is suggested. If negative, only prediction bands are displayed. Default is -1. Ignored if group is not NULL or bands is FALSE.

add.legend

Logical value indicating whether the legend for groups should be added. Default is TRUE.

pos.legend

Numerical vector of length 2 indicating the horizontal-vertical shift of the legend for groups with respect to the position 'topleft'. Default is c(0,0). Ignored if group is not NULL or add.legend is FALSE.

cex.legend

Expansion factor relative to the legend for groups. Default is 0.6. Ignored if group is not NULL or add.legend is FALSE.

mar

Numerical vector of length 4 indicating the margin size in the order: bottom, left, top, right, which will be applied to all indicators. Default is c(5.1,4.1,4.1,2.1).

...

Further graphical parameters.

Value

No return value.

Note

If unit is not NULL, values are back transformed to the original scales of indicators.

See Also

gbmt.

Examples

data(agrisus2)

# names of indicators (just a subset for illustration)
varNames <- c("TFP_2005", "NetCapital_GVA",
  "Income_rur", "Unempl_rur", "GHG_UAA", "GNB_N_UAA")

# model with 2 polynomial degrees and 3 groups
m3_2 <- gbmt(x.names=varNames, unit="Country", time="Year", d=2, ng=3, data=agrisus2, scaling=4)

# group trajectories including 3 steps ahead prediction
mar0 <- c(3.1,2.55,3.1,1.2)
plot(m3_2, n.ahead=3, mar=mar0)  ## overlapped groups
plot(m3_2, group=1, n.ahead=3, mar=mar0)  ## group 1
plot(m3_2, group=2, n.ahead=3, mar=mar0)  ## group 2
plot(m3_2, group=3, n.ahead=3, mar=mar0)  ## group 3

# same scale to ease comparisons
plot(m3_2, n.ahead=3, mar=mar0, equal.scale=TRUE)
plot(m3_2, group=1, n.ahead=3, mar=mar0, equal.scale=TRUE, trim=0.05)
plot(m3_2, group=2, n.ahead=3, mar=mar0, equal.scale=TRUE, trim=0.05)
plot(m3_2, group=3, n.ahead=3, mar=mar0, equal.scale=TRUE, trim=0.05)

# overlapped groups with transparency
plot(m3_2, group=1, n.ahead=3, mar=mar0, equal.scale=TRUE, trim=0.05,
  transparency=80)

# trajectories including 3 steps ahead prediction for unit 'Italy'
plot(m3_2, unit="Italy", n.ahead=3, transparency=80)

[Package gbmt version 0.1.3 Index]