| plot_response | R Documentation |
This function plots the effect-adjusted expected response for selected nonlinear variables in a PSTR model.
plot_response(
obj,
vars,
log_scale = FALSE,
length.out = 20,
color = "blue",
size = 1.5
)
obj |
An object of class |
vars |
Integer vector of column indices from the nonlinear part. |
log_scale |
Logical scalar or length-2 vector indicating whether to use log scale for the regressor and/or transition variable. |
length.out |
Scalar or length-2 numeric vector controlling grid size. |
color |
Line colour. |
size |
Line width. |
If the selected variable differs from the transition variable, a 3-D surface of
(\beta_{k,0} + \beta_{k,1} g(q;\gamma,c)) z_{k}
is plotted against z_k and the transition variable.
If the selected variable coincides with the transition variable, a curve is plotted instead.
In addition to the exported function
plot_response(obj = ...), the same functionality is available
as an R6 method via obj$plot_response(...).
A named list of ggplot2 (curve) and/or
plotly (surface) objects.
pstr <- NewPSTR(Hansen99, dep = "inva", indep = 4:20,
indep_k = c("vala","debta","cfa","sales"),
tvars = c("vala","debta","cfa","sales"), iT = 14)
pstr <- EstPSTR(use = pstr, im = 1, iq = 1,
useDelta = TRUE, par = c(.63,0), method = "CG")
# Exported interface
ret <- plot_response(pstr, vars = 1:4)
# R6 method
ret2 <- pstr$plot_response(vars = 1:4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.