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 |
group |
Numerical value indicating the group for which the estimated trajectories should be displayed. If |
unit |
Character indicating the name of the unit for which estimated trajectories should be displayed. If |
x.names |
Character including the names of the indicators for which the estimated trajectory should be displayed. If |
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 |
conf |
Numerical value indicating the confidence level for the prediction bands. Default is 0.05. Ignored if |
observed |
Logical indicating whether observed trajectories should be drawn. Default is |
equal.scale |
Logical indicating whether indicators should have the same scale across all groups. Default is |
trim |
Numerical value indicating the proportion of extreme values to trim when either |
ylim |
vector of length 2 indicating the limits of the y-axis, which will be applied to all indicators. If |
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 |
add.grid |
Logical value indicating whether the grid should be added. Default is |
col |
Character or numerical vector indicating the color of group trajectories. If |
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 |
add.legend |
Logical value indicating whether the legend for groups should be added. Default is |
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 |
cex.legend |
Expansion factor relative to the legend for groups. Default is 0.6. Ignored if |
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 |
... |
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)