Plot the predictions made by a circGLM analysis.
plot_predict.circGLM(
m,
x,
d,
th,
linkfun = function(x) m$r * atan(x),
xlab = NA,
ylab = expression(theta),
colorPalette = c("#E69F00", "#56B4E9")
)
A circGLM
object.
Optional; Either a numeric vector with a continuous predictor or
string naming the desired variable to plot on the x-axis. If missing, we
just use the first continuous predictor in the circGLM
object.
Optional; Either a numeric vector with a categorical predictor or
string naming the desired variable to plot on the x-axis. If missing, we
just use the first categorical predictor in the circGLM
object.
Optional; Can be a new numeric vector containing outcome angles
corresponding to predictors x
and potentially d
.
The link function to be used. Should be the same as was used
for the creation of the circGLM
object.
A character string with the x-label.
A character string with the y-label.
The colors to use in plotting, max 2.
A ggplot
, to which further ggplot
elements can be added.
Creates a ggplot showing a prediction plot showing linear predictor against the circular outcome, with an optional grouping variable. One or more regression lines show the predicted values for different values of the linear and categorical predictors.
Predictors x
and d
and outcome th
can be provided as
numeric vectors of the same length as the outcome in the circGLM
object m
. This allows plotting the regression line from an earlier
dataset on a new dataset.
Alternatively, x
and d
can be strings containing names of
corresponding predictors in the original model. In that case, th
should not be provided.
The function makes an effort to find predictors to plot if none are given,
where it will simply take the first predictor in the dataset. If a plot
without grouping is required, d
can be set to NA
.
plot_trace.circGLM
,
plot_tracestack.circGLM
,
plot_meancompare.circGLM
,
plot_meanboxplot.circGLM
, plot.circGLM
.
# NOT RUN {
dat <- generateCircGLMData()
m <- circGLM(th ~ ., dat, Q = 100, burnin = 0)
plot(m, type = "predict")
# }
Run the code above in your browser using DataLab