buildMS
and statsMS
, but can be
easily adapted to work with any model structure and performance measure.plotMS(obj, grid, line, ind, type = c("b", "g"), pch = c(20, 2),
size = 0.5, arrange = "desc", color = NULL, xlim = NULL,
ylab = NULL, xlab = NULL, at = NULL, ...)
data.frame
, generally returned by
statsMS
, containing a 1) series of performance
statistics of several models, and 2) the design information of each model.
See data.frame
containing the design data which will be
gridded using the function levelplot
. See
statsMS
) should be
plotted using the function xyplot
. See
xyplot
. Defaults
to type = c("b", "g")
. See panel.xyplot
ind
ind
.
Defaults to size = 0.5
. See grid.points
for more
iasc
) or descending (desc
)
order. Defaults to arrange = "desc"
. See arrange
levelplot
. If NULL
, defaults to
color = cm.colors(n)
, where n
is the number of unique values
in the columns defined by argument NULL
(which is the recommended value), defaults to
xlim = c(0.5, dim(obj)[1] + 0.5)
. This is, so far, the optimum range
for adequate plotting.obj
is a data.frame
returned by statsMS
, and the
performance statistic passed to argument line
is one of those
calculated by statsMS
xlab = "Model ranking"
.asp
, for example, is not effective since the function
automatically identifies the best aspect for plotting based on the dimensions
of the design data."trellis"
consisting of a model series
plot.obj
, grid
,
line
, arrange
, and ind
.
obj
usually constitutes a data.frame
returned by
statsMS
. However, the user can use any data.frame
object as far
as it contains the two basic units of information needed:
grid
line
grid
indicates the design data which is used to
produce the grid output in the top of the model series plot. By design
we mean the data that specify the structure of each model and how they differ
from each other. Suppose that eight linear models were fit using three types
of predictor variables (a
, b
, and c
). Each of these
predictor variables is available in two versions that differ by their
accuracy, where 0
means a less accurate predictor variable, while
1
means a more accurate predictor variable. This yields 2^3 = 8 total
possible combinations. The design data would be of the following form:
line
corresponds to the performance statistic that is
used to arrange the models in ascending or descending order, and to produce
the line output in the bottom of the model series plot. For example, it can
be a series of values of adjusted coefficient of determination, one for each
model:arrange
automatically arranges the model series
according to the performance statistics selected with argument line
.
If obj
is a data.frame
returned by statsMS()
, then the
function uses standard arranging approaches. For most performance
statistics, the models are arranged in descending order. The exception is
when "r2"
, "adj_r2"
or "ADJ_r2"
are used, in which case
the models are arranged in ascending order. This means that the model with
lowest value appears in the leftmost side of the model series plot, while the
models with the highest value appears in the rightmost side of the plot.
This results suggest that the best performing model is that of id = 7
,
while the model of id = 5
is the poorest one.
}
The argument ind
provides another tool to help identifying how the
design, more specifically how each variable in the design data,
influences model performance. This is done by simply calculating the mean
ranking of the models that were built using the updated version of each
predictor variable. This very same mean ranking is also used to rank the
predictor variables and thus identify which of them is the most important.
After arranging the design
data described above using the adjusted
coefficient of determination, the following mean rank is obtained for each
predictor variable:
This result suggests that the best model performance is obtained when using
the updated version of the predictor variable b
. In the model series
plot, the predictor variable b
appears in the top row, while the
predictor variable c
appears in the bottom row.
}
Roger D. Peng (2008). A method for visualizing multivariate time series data. Journal of Statistical Software. v. 25 (Code Snippet), p. 1-17.
Roger D. Peng (2012). mvtsplot: Multivariate Time Series Plot. R
package version 1.0-1.
levelplot
, xyplot
,
mvtsplot
.# This example follows the discussion in section "Details"
# Note that the data.frame is created manually
id <- c(1:8)
design <- data.frame(a = c(0, 0, 1, 0, 1, 0, 1, 1),
b = c(0, 0, 0, 1, 0, 1, 1, 1),
c = c(0, 1, 0, 0, 1, 1, 0, 1))
adj_r2 <- c(0.87, 0.74, 0.81, 0.85, 0.54, 0.86, 0.90, 0.89)
obj <- cbind(id, design, adj_r2)
p <- plotMS(obj, grid = c(2:4), line = "adj_r2", ind = 1,
color = c("lightyellow", "palegreen"),
main = "Model Series Plot")
print(p)
Run the code above in your browser using DataLab