Description Usage Arguments Details Author(s) References See Also Examples
plot
method and panel functions for tvcm
objects.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## S3 method for class 'tvcm'
plot(x, type = c("default", "coef",
"simple", "partdep", "cv"),
main, part = NULL, drop_terminal = TRUE,
tnex, newpage = TRUE, ask = NULL,
pop = TRUE, gp = gpar(), ...)
panel_partdep(object, parm = NULL,
var = NULL, ask = NULL,
prob = NULL, neval = 50, add = FALSE,
etalab = c("int", "char", "eta"), ...)
panel_coef(object, parm = NULL,
id = TRUE, nobs = TRUE,
exp = FALSE,
plot_gp = list(),
margins, yadj = 0.1,
mean = FALSE, mean_gp = list(),
conf.int = FALSE, conf.int_gp = list(),
abbreviate = TRUE, etalab = c("int", "char", "eta"), ...)
|
x, object |
An object of class |
type |
the type of the plot. Available types are
|
main |
character. A main title for the plot. |
drop_terminal |
a logical indicating whether all terminal nodes
should be plotted at the bottom. See also
|
tnex |
a numeric value giving the terminal node extension in relation to the inner nodes. By default the value is computed adaptively to the tree size. |
newpage |
a logical indicating whether |
pop |
a logical whether the viewport tree should be popped before return. |
gp |
graphical parameters. See |
part |
integer or letter. The partition i.e. varying coefficient component to be plotted. |
parm |
character vector ( |
var |
character vector. Indicates the partitioning variables to be visualized. |
ask |
logical. Whether an input should be asked before printing the next panel. |
prob |
a probability between 0 and 1. Gives the size of the random subsample over which the coefficients are averaged. May be smaller than 1 if the sample is large. |
neval |
the maximal number of distinct values of the variable to be evaluated. |
add |
logical. Whether the panel is to be added into an active plot. |
id |
logical. Whether the node id should be displayed. |
nobs |
logical. Whether the number of observations in each node should be displayed. |
exp |
logical. Whether the labels in the y-axes should be the exponential of coefficients. |
plot_gp |
a list of graphical parameters for the panels. Includes
components |
margins |
a numeric vector |
yadj |
a numeric scalar larger than zero that increases the margin above the panel. May be useful if the edge labels are covered by the coefficient panels. |
mean |
logical. Whether the average coefficients over the population should be visualized. |
mean_gp |
list with graphical parameters for plotting the mean
coefficients. Includes a component |
conf.int |
logical. Whether confidence intervals should be visualized. These are indicative values only. They do not account for the uncertainty of model selection procedure. |
conf.int_gp |
a list of graphical parameters for the confidence
intervals applied to |
abbreviate |
logical scalar. Whether labels of coefficients should be abbreviated. |
etalab |
character. Whether category-specific effects should be
labeled by integers of categories (default), the labels of the
categories ( |
... |
additional arguments passed to
|
The plot functions allow the diagnosis of fitted tvcm
objects. type = "default"
, type = "coef"
and
type = "simple"
show the tree structure and coefficients in
each node. type = "partdep"
plots partial dependency plots, see
Hastie et al. (2001), section 10.13.2. Finally, type = "cv"
shows, if available, the results from cross-validation.
The functions panel_partdep
and
panel_coef
are exported to show the additional
arguments that can be passed to ...
of a
plot
call.
Notice that user-defined plots can be generated by the use of the
plot.party
function, see partykit.
Reto Buergin
Hastie, T., R. Tibshirani and J. Friedman (2001). The Elements of Statistical Learning (2 ed.). New York, USA: Springer-Verlag.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | ## ------------------------------------------------------------------- #
## Dummy example:
##
## Plotting the types "coef" and "partdep" for a 'tvcm' object fitted
## on the artificial data 'vcrpart_2'.
## ------------------------------------------------------------------- #
data(vcrpart_2)
## fit the model
model <- tvcglm(y ~ vc(z1, z2, by = x1, intercept = TRUE) + x2,
data = vcrpart_2, family = gaussian(),
control = tvcm_control(maxwidth = 3, minbucket = 5L))
## plot type "coef"
plot(model, "coef")
## add various (stupid) plot parameters
plot(model, "coef",
plot_gp = list(type = "p", pch = 2, ylim = c(-4, 4),
label = c("par1", "par2"), gp = gpar(col = "blue")),
conf.int_gp = list(angle = 45, length = unit(2, "mm"),
ends = "last", type = "closed"),
mean_gp = list(pch = 16,
gp = gpar(fontsize = 16, cex = 2, col = "red")))
## separate plots with separate plot parameters
plot(model, "coef", parm = list("(Intercept)", "x1"), tnex = 2,
plot_gp = list(list(gp = gpar(col = "red")),
list(gp = gpar(col = "blue"))),
mean_gp = list(list(gp = gpar(col = "green")),
list(gp = gpar(col = "yellow"))))
## plot type "partdep"
par(mfrow = c(1, 2))
plot(model, "partdep", var = "z1", ask = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.