plot_diff2 | R Documentation |
Plot difference surface based on model predictions.
plot_diff2( model, view, comp, cond = NULL, color = "terrain", nCol = 100, col = NULL, add.color.legend = TRUE, se = 1.96, sim.ci = FALSE, show.diff = FALSE, col.diff = 1, alpha.diff = 0.5, n.grid = 30, nlevels = 10, zlim = NULL, xlim = NULL, ylim = NULL, main = NULL, xlab = NULL, ylab = NULL, rm.ranef = TRUE, transform.view = NULL, hide.label = FALSE, dec = NULL, f = 1.96, print.summary = getOption("itsadug_print"), ... )
model |
A GAMM model, resulting from the functions
|
view |
Name of continuous predictors that should be plotted on the x- and y-axes. Vector of two values. |
comp |
Named list with the grouping predictor (categorical variable) and the 2 levels to calculate the difference for. |
cond |
Named list of the values to use for the other predictor terms (not in view). |
color |
The color scheme to use for plots. One of 'topo', 'heat', 'cm', 'terrain', 'gray' or 'bw'. Alternatively a vector with some colors can be provided for a custom color palette. |
nCol |
Range of colors of background of contour plot. |
col |
Line color. |
add.color.legend |
Logical: whether or not to add a color legend.
Default is TRUE. If FALSE (omitted), one could use the function
|
se |
If less than or equal to zero then only the predicted surface is
plotted, but if greater than zero, then the predicted values plus
confidence intervals are plotted.
The value of |
sim.ci |
Logical: Using simultaneous confidence intervals or not
(default set to FALSE). The implementation of simultaneous CIs follows
Gavin Simpson's blog of December 15, 2016:
https://fromthebottomoftheheap.net/2016/12/15/simultaneous-interval-revisited/.
This interval is calculated from simulations based.
Please specify a seed (e.g., |
show.diff |
Logical: whether or not to indicate the regions that
are significantly different from zero. Note that these regions are just
an indication and dependent on the value of |
col.diff |
Color to shade the nonsignificant areas. |
alpha.diff |
Level of transparency to mark the nonsignificant areas. |
n.grid |
Resolution. |
nlevels |
Levels of contour lines. |
zlim |
A two item array giving the lower and upper limits for the z- axis scale. NULL to choose automatically. |
xlim |
A two item array giving the lower and upper limits for the x- axis scale. NULL to choose automatically. |
ylim |
A two item array giving the lower and upper limits for the y- axis scale. NULL to choose automatically. |
main |
Title of plot. |
xlab |
Label x-axis. |
ylab |
Label y-axis. |
rm.ranef |
Logical: whether or not to remove random effects. Default is TRUE. Alternatively a string (or vector of strings) with the name of the random effect(s) to remove. |
transform.view |
List with two functions for transforming
the values on the x- and y-axis respectively. If one of the axes
need to be transformed, set the other to NULL (no transformation).
(See |
hide.label |
Logical: whether or not to hide the label (i.e., 'difference'). Default is FALSE. |
dec |
Numeric: number of decimals for rounding the color legend.
When NULL (default), no rounding. If -1 (default), automatically determined.
Note: if value = -1 (default), rounding will be applied also when
|
f |
Scaling factor to determine the CI from the se, for marking the
difference with 0. Only applies when |
print.summary |
Logical: whether or not to print a summary.
Default set to the print info messages option
(see |
... |
Optional arguments for |
If the result is not being plotted, a list is
returned with the estimated difference (est
) and the standard error
over the estimate (se.est
) and the x-values (x
) is returned.
When the argument show.diff
is set to TRUE a shading area indicates
where the confidence intervals include zero. Or, in other words, the areas
that are not significantly different from zero. Be careful with the
interpretation, however, as the precise shape of the surface is dependent
on model constraints such as the value of choose.k
and the
smooth function used, and the size of the confidence intervals are
dependent on the model fit and model characteristics
(see vignette('acf', package='itsadug')
). In addition, the value of
n.grid
determines the precision of the plot.
Martijn Wieling, reimplemented by Jacolien van Rij
Other Testing for significance:
compareML()
,
plot_diff()
,
report_stats()
,
wald_gam()
data(simdat) ## Not run: m1 <- bam(Y ~ Group + te(Time, Trial, by=Group), data=simdat) plot_diff2(m1, view=c('Time', 'Trial'), comp=list(Group=c('Children', 'Adults'))) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.