plot_parametric | R Documentation |
Plots a smooth from a gam
or
bam
model based on predictions.
In contrast with the default plot.gam
, this function
plots the summed effects and optionally removes the random effects.
plot_parametric( x, pred, cond = list(), parametricOnly = FALSE, rm.ranef = TRUE, col = "black", se = 1.96, print.summary = getOption("itsadug_print"), main = NULL, xlab = NULL, ... )
x |
A gam object, produced by |
pred |
A named list of the values to use for the predictor terms to plot. |
cond |
A named list of the values to use for the other predictor terms (not in view). Used for choosing between smooths that share the same view predictors. |
parametricOnly |
Logical: whether or not to cancel out all smooth terms and only use the predictors in the parametric summary. |
rm.ranef |
Logical: whether or not to remove random effects. Default is TRUE. |
col |
The colors for the lines and the error bars of the plot. |
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 se will be multiplied with the standard error (i.e., 1.96 results in 95%CI and 2.58). |
print.summary |
Logical: whether or not to print summary.
Default set to the print info messages option
(see |
main |
Changing the main title for the plot, see also title. |
xlab |
Changing the label for the x axis, defaults to a description of x. |
... |
other options to pass on to |
Use parametricOnly
with care! When set to TRUE, all smooth
predictors are set to 0. Note that this might result in strange
predictions, because a value of 0 does not always represents a realistic
situation (e.g., body temperature of 0 is highly unlikely).
Note that linear slopes are not set to zero, because they are
considered as parametric terms. If cond
does not specify a value for
these continuous predictors, the closes value to the mean is automatically
selected.
Jacolien van Rij, based on a function of Fabian Tomaschek
plot.gam
Other Functions for model inspection:
dispersion()
,
fvisgam()
,
gamtabs()
,
inspect_random()
,
plot_data()
,
plot_smooth()
,
plot_topo()
,
pvisgam()
data(simdat) ## Not run: m1 <- bam(Y ~ Group + te(Time, Trial, by=Group) + s(Time, Subject, bs='fs', m=1), data=simdat) plot_parametric(m1, pred=list(Group=c('Adults', 'Children'))) # Note the summary that is printed. # use rm.ranef to cancel random effects: plot_parametric(m1, pred=list(Group=c('Adults', 'Children')), rm.ranef = TRUE) # It is possible to get estimates that do not make sense: out <- plot_parametric(m1, pred=list(Group=c('Adults', 'Children'), Subject=c('a01', 'a02', 'c01'))) print(out) ## End(Not run) # see the vignette for examples: vignette('overview', package='itsadug')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.